From d2fd7f88fdb7a9c20799a5ddacb4d365a6372090 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Fri, 5 Aug 2016 18:12:31 -0700 Subject: [PATCH] Enabling OSX Oculus plugin --- .../src/display-plugins/hmd/HmdDisplayPlugin.h | 1 - plugins/oculusLegacy/CMakeLists.txt | 4 +--- plugins/oculusLegacy/src/OculusLegacyDisplayPlugin.cpp | 9 +++++---- tests/entities/CMakeLists.txt | 2 +- tests/gpu-test/src/TestWindow.cpp | 3 +-- tests/gpu-test/src/main.cpp | 1 - tests/render-perf/src/main.cpp | 3 +-- tests/render-utils/src/main.cpp | 3 +-- tests/shaders/src/main.cpp | 3 +-- tools/vhacd-util/CMakeLists.txt | 2 +- 10 files changed, 12 insertions(+), 19 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h index ac2efb9071..fc3b40670a 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h @@ -100,7 +100,6 @@ private: bool _disablePreview{ true }; bool _monoPreview { true }; bool _clearPreviewFlag { false }; - float _previewAspect { 0 }; gpu::TexturePointer _previewTexture; struct OverlayRenderer { diff --git a/plugins/oculusLegacy/CMakeLists.txt b/plugins/oculusLegacy/CMakeLists.txt index b3d2394f9c..f4e1bb76a2 100644 --- a/plugins/oculusLegacy/CMakeLists.txt +++ b/plugins/oculusLegacy/CMakeLists.txt @@ -9,12 +9,11 @@ # Windows doesn't need this, and building it currently make Linux unstable. # if (NOT WIN32) -if (FALSE) if (APPLE) set(TARGET_NAME oculusLegacy) setup_hifi_plugin() - link_hifi_libraries(shared gl gpu plugins ui ui-plugins display-plugins input-plugins) + link_hifi_libraries(shared gl gpu gpu-gl plugins ui ui-plugins display-plugins input-plugins) include_hifi_library_headers(octree) @@ -28,4 +27,3 @@ if (APPLE) endif() -endif() \ No newline at end of file diff --git a/plugins/oculusLegacy/src/OculusLegacyDisplayPlugin.cpp b/plugins/oculusLegacy/src/OculusLegacyDisplayPlugin.cpp index 6da842b7b9..60b6d49d49 100644 --- a/plugins/oculusLegacy/src/OculusLegacyDisplayPlugin.cpp +++ b/plugins/oculusLegacy/src/OculusLegacyDisplayPlugin.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "OculusHelpers.h" @@ -51,8 +52,8 @@ bool OculusLegacyDisplayPlugin::beginFrameRender(uint32_t frameIndex) { _currentRenderFrameInfo = FrameInfo(); _currentRenderFrameInfo.predictedDisplayTime = _currentRenderFrameInfo.sensorSampleTime = ovr_GetTimeInSeconds(); _trackingState = ovrHmd_GetTrackingState(_hmd, _currentRenderFrameInfo.predictedDisplayTime); - _currentRenderFrameInfo.rawRenderPose = _currentRenderFrameInfo.renderPose = toGlm(_trackingState.HeadPose.ThePose); - withRenderThreadLock([&]{ + _currentRenderFrameInfo.renderPose = toGlm(_trackingState.HeadPose.ThePose); + withNonPresentThreadLock([&]{ _frameInfos[frameIndex] = _currentRenderFrameInfo; }); return Parent::beginFrameRender(frameIndex); @@ -256,13 +257,13 @@ void OculusLegacyDisplayPlugin::hmdPresent() { memset(eyePoses, 0, sizeof(ovrPosef) * 2); eyePoses[0].Orientation = eyePoses[1].Orientation = ovrRotation; - GLint texture = oglplus::GetName(_compositeFramebuffer->color); + GLint texture = getGLBackend()->getTextureID(_compositeTexture, false); auto sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glFlush(); if (_hmdWindow->makeCurrent()) { glClearColor(0, 0.4, 0.8, 1); glClear(GL_COLOR_BUFFER_BIT); - ovrHmd_BeginFrame(_hmd, _currentPresentFrameIndex); + ovrHmd_BeginFrame(_hmd, _currentFrame->frameIndex); glWaitSync(sync, 0, GL_TIMEOUT_IGNORED); glDeleteSync(sync); ovr_for_each_eye([&](ovrEyeType eye) { diff --git a/tests/entities/CMakeLists.txt b/tests/entities/CMakeLists.txt index a6ce4cf956..448ea83956 100644 --- a/tests/entities/CMakeLists.txt +++ b/tests/entities/CMakeLists.txt @@ -7,6 +7,6 @@ setup_hifi_project(Network Script) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") # link in the shared libraries -link_hifi_libraries(entities avatars shared octree gpu model fbx networking animation audio) +link_hifi_libraries(entities avatars shared octree gpu model fbx networking animation audio gl) package_libraries_for_deployment() diff --git a/tests/gpu-test/src/TestWindow.cpp b/tests/gpu-test/src/TestWindow.cpp index 5566fa92a4..6917cf027f 100644 --- a/tests/gpu-test/src/TestWindow.cpp +++ b/tests/gpu-test/src/TestWindow.cpp @@ -15,7 +15,6 @@ #include #include -#include #include @@ -74,7 +73,7 @@ void TestWindow::initGl() { DependencyManager::set(); resize(QSize(800, 600)); - setupDebugLogger(this); + GLDebug::setupLogger(this); #ifdef DEFERRED_LIGHTING auto deferredLightingEffect = DependencyManager::get(); deferredLightingEffect->init(); diff --git a/tests/gpu-test/src/main.cpp b/tests/gpu-test/src/main.cpp index 0f06546327..008f363e53 100644 --- a/tests/gpu-test/src/main.cpp +++ b/tests/gpu-test/src/main.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/tests/render-perf/src/main.cpp b/tests/render-perf/src/main.cpp index 32e6217ab9..5d52f3be34 100644 --- a/tests/render-perf/src/main.cpp +++ b/tests/render-perf/src/main.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -365,7 +364,7 @@ public: glewExperimental = true; glewInit(); glGetError(); - setupDebugLogger(this); + GLDebug::setupLogger(this); #ifdef Q_OS_WIN wglSwapIntervalEXT(0); #endif diff --git a/tests/render-utils/src/main.cpp b/tests/render-utils/src/main.cpp index ccb91590c3..4b7354f35d 100644 --- a/tests/render-utils/src/main.cpp +++ b/tests/render-utils/src/main.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include @@ -114,7 +113,7 @@ public: gpu::Context::init(); - setupDebugLogger(this); + GLDebug::setupLogger(this); qDebug() << (const char*)glGetString(GL_VERSION); //_textRenderer[0] = TextRenderer::getInstance(SANS_FONT_FAMILY, 12, false); diff --git a/tests/shaders/src/main.cpp b/tests/shaders/src/main.cpp index 9c4a835966..5355f29f19 100644 --- a/tests/shaders/src/main.cpp +++ b/tests/shaders/src/main.cpp @@ -20,7 +20,6 @@ #include -#include #include #include @@ -111,7 +110,7 @@ public: makeCurrent(); gpu::Context::init(); - setupDebugLogger(this); + GLDebug::setupLogger(this); makeCurrent(); resize(QSize(800, 600)); } diff --git a/tools/vhacd-util/CMakeLists.txt b/tools/vhacd-util/CMakeLists.txt index c94b2ad083..810d13ffd7 100644 --- a/tools/vhacd-util/CMakeLists.txt +++ b/tools/vhacd-util/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME vhacd-util) setup_hifi_project(Core Widgets) -link_hifi_libraries(shared fbx model gpu) +link_hifi_libraries(shared fbx model gpu gl) add_dependency_external_projects(vhacd)