mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:47:51 +02:00
Working on SDK 0.6
This commit is contained in:
parent
119f37a178
commit
6a60da2a6c
1 changed files with 23 additions and 16 deletions
|
@ -219,6 +219,7 @@ void OculusManager::deinit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OculusManager::connect() {
|
void OculusManager::connect() {
|
||||||
|
qCDebug(interfaceapp) << "Oculus SDK" << OVR_VERSION_STRING;
|
||||||
|
|
||||||
ovrInitParams initParams; memset(&initParams, 0, sizeof(initParams));
|
ovrInitParams initParams; memset(&initParams, 0, sizeof(initParams));
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -245,10 +246,13 @@ void OculusManager::connect() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_isConnected = false;
|
||||||
|
|
||||||
|
// we're definitely not in "VR mode" so tell the menu that
|
||||||
|
Menu::getInstance()->getActionForOption(MenuOption::EnableVRMode)->setChecked(false);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
_calibrationState = UNCALIBRATED;
|
_calibrationState = UNCALIBRATED;
|
||||||
qCDebug(interfaceapp) << "Oculus SDK" << OVR_VERSION_STRING;
|
|
||||||
if (_ovrHmd) {
|
|
||||||
if (!_isConnected) {
|
if (!_isConnected) {
|
||||||
UserActivityLogger::getInstance().connectedDevice("hmd", "oculus");
|
UserActivityLogger::getInstance().connectedDevice("hmd", "oculus");
|
||||||
}
|
}
|
||||||
|
@ -677,6 +681,7 @@ void OculusManager::display(QGLWidget * glCanvas, const glm::quat &bodyOrientati
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
auto srcFboSize = finalFbo->getSize();
|
auto srcFboSize = finalFbo->getSize();
|
||||||
|
|
||||||
|
// Blit to the oculus provided texture
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo));
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo));
|
||||||
_swapFbo->Bound(oglplus::Framebuffer::Target::Draw, [&] {
|
_swapFbo->Bound(oglplus::Framebuffer::Target::Draw, [&] {
|
||||||
glBlitFramebuffer(
|
glBlitFramebuffer(
|
||||||
|
@ -684,6 +689,8 @@ void OculusManager::display(QGLWidget * glCanvas, const glm::quat &bodyOrientati
|
||||||
0, 0, _swapFbo->size.x, _swapFbo->size.y,
|
0, 0, _swapFbo->size.x, _swapFbo->size.y,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Blit to the onscreen window
|
||||||
auto destWindowSize = qApp->getDeviceSize();
|
auto destWindowSize = qApp->getDeviceSize();
|
||||||
glBlitFramebuffer(
|
glBlitFramebuffer(
|
||||||
0, 0, srcFboSize.x, srcFboSize.y,
|
0, 0, srcFboSize.x, srcFboSize.y,
|
||||||
|
@ -691,6 +698,7 @@ void OculusManager::display(QGLWidget * glCanvas, const glm::quat &bodyOrientati
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
|
// Submit the frame to the Oculus SDK for timewarp and distortion
|
||||||
for_each_eye([&](ovrEyeType eye) {
|
for_each_eye([&](ovrEyeType eye) {
|
||||||
_sceneLayer.RenderPose[eye] = eyeRenderPose[eye];
|
_sceneLayer.RenderPose[eye] = eyeRenderPose[eye];
|
||||||
});
|
});
|
||||||
|
@ -705,23 +713,22 @@ void OculusManager::display(QGLWidget * glCanvas, const glm::quat &bodyOrientati
|
||||||
glEyeTexture.OGL.TexId = textureId;
|
glEyeTexture.OGL.TexId = textureId;
|
||||||
});
|
});
|
||||||
|
|
||||||
//ovrHmd_EndFrame(_ovrHmd, eyeRenderPose, _eyeTextures);
|
// restore our normal viewport
|
||||||
glClearColor(0, 0, 0, 1);
|
glViewport(0, 0, deviceSize.width(), deviceSize.height());
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
ovrHmd_EndFrame(_ovrHmd, eyeRenderPose, _eyeTextures);
|
||||||
auto srcFboSize = finalFbo->getSize();
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo));
|
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
auto destWindowSize = qApp->getDeviceSize();
|
// auto srcFboSize = finalFbo->getSize();
|
||||||
glBlitFramebuffer(
|
// glBindFramebuffer(GL_READ_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo));
|
||||||
0, 0, srcFboSize.x, srcFboSize.y,
|
// glBlitFramebuffer(
|
||||||
0, 0, destWindowSize.width(), destWindowSize.height(),
|
// 0, 0, srcFboSize.x, srcFboSize.y,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
// 0, 0, deviceSize.width(), deviceSize.height(),
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
// GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
glCanvas->swapBuffers();
|
// glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
// glCanvas->swapBuffers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// restore our normal viewport
|
|
||||||
glViewport(0, 0, deviceSize.width(), deviceSize.height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tries to reconnect to the sensors
|
//Tries to reconnect to the sensors
|
||||||
|
|
Loading…
Reference in a new issue