mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
Fixing mac build
This commit is contained in:
parent
5515b9d8ee
commit
bfd0362bd8
2 changed files with 22 additions and 4 deletions
|
@ -92,7 +92,7 @@ void Oculus_0_5_DisplayPlugin::activate() {
|
||||||
OculusBaseDisplayPlugin::activate();
|
OculusBaseDisplayPlugin::activate();
|
||||||
int screen = getHmdScreen();
|
int screen = getHmdScreen();
|
||||||
if (screen != -1) {
|
if (screen != -1) {
|
||||||
container->setFullscreen(qApp->screens()[screen]);
|
CONTAINER->setFullscreen(qApp->screens()[screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_window->installEventFilter(this);
|
_window->installEventFilter(this);
|
||||||
|
@ -134,7 +134,7 @@ void Oculus_0_5_DisplayPlugin::deactivate() {
|
||||||
if (_hmdScreen >= 0) {
|
if (_hmdScreen >= 0) {
|
||||||
riftScreen = qApp->screens()[_hmdScreen];
|
riftScreen = qApp->screens()[_hmdScreen];
|
||||||
}
|
}
|
||||||
_container->unsetFullscreen(riftScreen);
|
CONTAINER->unsetFullscreen(riftScreen);
|
||||||
|
|
||||||
ovrHmd_Destroy(_hmd);
|
ovrHmd_Destroy(_hmd);
|
||||||
_hmd = nullptr;
|
_hmd = nullptr;
|
||||||
|
|
|
@ -35,7 +35,6 @@ using namespace Oculus;
|
||||||
SwapFboPtr _sceneFbo;
|
SwapFboPtr _sceneFbo;
|
||||||
MirrorFboPtr _mirrorFbo;
|
MirrorFboPtr _mirrorFbo;
|
||||||
ovrLayerEyeFov _sceneLayer;
|
ovrLayerEyeFov _sceneLayer;
|
||||||
#endif
|
|
||||||
|
|
||||||
// A base class for FBO wrappers that need to use the Oculus C
|
// A base class for FBO wrappers that need to use the Oculus C
|
||||||
// API to manage textures via ovrHmd_CreateSwapTextureSetGL,
|
// API to manage textures via ovrHmd_CreateSwapTextureSetGL,
|
||||||
|
@ -150,6 +149,9 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
const QString Oculus_0_6_DisplayPlugin::NAME("Oculus Rift");
|
const QString Oculus_0_6_DisplayPlugin::NAME("Oculus Rift");
|
||||||
|
|
||||||
const QString & Oculus_0_6_DisplayPlugin::getName() const {
|
const QString & Oculus_0_6_DisplayPlugin::getName() const {
|
||||||
|
@ -157,6 +159,7 @@ const QString & Oculus_0_6_DisplayPlugin::getName() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Oculus_0_6_DisplayPlugin::isSupported() const {
|
bool Oculus_0_6_DisplayPlugin::isSupported() const {
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
if (!OVR_SUCCESS(ovr_Initialize(nullptr))) {
|
if (!OVR_SUCCESS(ovr_Initialize(nullptr))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -166,15 +169,22 @@ bool Oculus_0_6_DisplayPlugin::isSupported() const {
|
||||||
}
|
}
|
||||||
ovr_Shutdown();
|
ovr_Shutdown();
|
||||||
return result;
|
return result;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
ovrLayerEyeFov& getSceneLayer() {
|
ovrLayerEyeFov& getSceneLayer() {
|
||||||
return _sceneLayer;
|
return _sceneLayer;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//static gpu::TexturePointer _texture;
|
//static gpu::TexturePointer _texture;
|
||||||
|
|
||||||
void Oculus_0_6_DisplayPlugin::activate() {
|
void Oculus_0_6_DisplayPlugin::activate() {
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
if (!OVR_SUCCESS(ovr_Initialize(nullptr))) {
|
if (!OVR_SUCCESS(ovr_Initialize(nullptr))) {
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
qFatal("Failed to Initialize SDK");
|
qFatal("Failed to Initialize SDK");
|
||||||
|
@ -208,10 +218,11 @@ void Oculus_0_6_DisplayPlugin::activate() {
|
||||||
ovrTrackingCap_Orientation | ovrTrackingCap_Position | ovrTrackingCap_MagYawCorrection, 0))) {
|
ovrTrackingCap_Orientation | ovrTrackingCap_Position | ovrTrackingCap_MagYawCorrection, 0))) {
|
||||||
qFatal("Could not attach to sensor device");
|
qFatal("Could not attach to sensor device");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Oculus_0_6_DisplayPlugin::customizeContext() {
|
void Oculus_0_6_DisplayPlugin::customizeContext() {
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
OculusBaseDisplayPlugin::customizeContext();
|
OculusBaseDisplayPlugin::customizeContext();
|
||||||
|
|
||||||
//_texture = DependencyManager::get<TextureCache>()->
|
//_texture = DependencyManager::get<TextureCache>()->
|
||||||
|
@ -222,9 +233,11 @@ void Oculus_0_6_DisplayPlugin::customizeContext() {
|
||||||
|
|
||||||
_sceneFbo = SwapFboPtr(new SwapFramebufferWrapper(_hmd));
|
_sceneFbo = SwapFboPtr(new SwapFramebufferWrapper(_hmd));
|
||||||
_sceneFbo->Init(getRecommendedRenderSize());
|
_sceneFbo->Init(getRecommendedRenderSize());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Oculus_0_6_DisplayPlugin::deactivate() {
|
void Oculus_0_6_DisplayPlugin::deactivate() {
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
_sceneFbo.reset();
|
_sceneFbo.reset();
|
||||||
_mirrorFbo.reset();
|
_mirrorFbo.reset();
|
||||||
|
@ -236,9 +249,11 @@ void Oculus_0_6_DisplayPlugin::deactivate() {
|
||||||
ovrHmd_Destroy(_hmd);
|
ovrHmd_Destroy(_hmd);
|
||||||
_hmd = nullptr;
|
_hmd = nullptr;
|
||||||
ovr_Shutdown();
|
ovr_Shutdown();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Oculus_0_6_DisplayPlugin::display(GLuint finalTexture, const glm::uvec2& sceneSize) {
|
void Oculus_0_6_DisplayPlugin::display(GLuint finalTexture, const glm::uvec2& sceneSize) {
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
using namespace oglplus;
|
using namespace oglplus;
|
||||||
// Need to make sure only the display plugin is responsible for
|
// Need to make sure only the display plugin is responsible for
|
||||||
// controlling vsync
|
// controlling vsync
|
||||||
|
@ -293,10 +308,12 @@ void Oculus_0_6_DisplayPlugin::display(GLuint finalTexture, const glm::uvec2& sc
|
||||||
});
|
});
|
||||||
|
|
||||||
++_frameIndex;
|
++_frameIndex;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass input events on to the application
|
// Pass input events on to the application
|
||||||
bool Oculus_0_6_DisplayPlugin::eventFilter(QObject* receiver, QEvent* event) {
|
bool Oculus_0_6_DisplayPlugin::eventFilter(QObject* receiver, QEvent* event) {
|
||||||
|
#if (OVR_MAJOR_VERSION == 6)
|
||||||
if (event->type() == QEvent::Resize) {
|
if (event->type() == QEvent::Resize) {
|
||||||
QResizeEvent* resizeEvent = static_cast<QResizeEvent*>(event);
|
QResizeEvent* resizeEvent = static_cast<QResizeEvent*>(event);
|
||||||
qDebug() << resizeEvent->size().width() << " x " << resizeEvent->size().height();
|
qDebug() << resizeEvent->size().width() << " x " << resizeEvent->size().height();
|
||||||
|
@ -305,6 +322,7 @@ bool Oculus_0_6_DisplayPlugin::eventFilter(QObject* receiver, QEvent* event) {
|
||||||
_mirrorFbo->Resize(newSize);
|
_mirrorFbo->Resize(newSize);
|
||||||
doneCurrent();
|
doneCurrent();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return OculusBaseDisplayPlugin::eventFilter(receiver, event);
|
return OculusBaseDisplayPlugin::eventFilter(receiver, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue