mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
A little bit of display plugin API cleanup
This commit is contained in:
parent
a923c044a3
commit
196a92c1b4
21 changed files with 67 additions and 265 deletions
|
@ -1121,11 +1121,11 @@ void Application::resizeGL() {
|
|||
|
||||
// Set the desired FBO texture size. If it hasn't changed, this does nothing.
|
||||
// Otherwise, it must rebuild the FBOs
|
||||
QSize framebufferSize = getActiveDisplayPlugin()->getRecommendedFramebufferSize();
|
||||
QSize renderSize = framebufferSize * getRenderResolutionScale();
|
||||
if (_renderResolution != toGlm(renderSize)) {
|
||||
_renderResolution = toGlm(renderSize);
|
||||
DependencyManager::get<TextureCache>()->setFrameBufferSize(renderSize);
|
||||
uvec2 framebufferSize = getActiveDisplayPlugin()->getRecommendedRenderSize();
|
||||
uvec2 renderSize = uvec2(vec2(framebufferSize) * getRenderResolutionScale());
|
||||
if (_renderResolution != renderSize) {
|
||||
_renderResolution = renderSize;
|
||||
DependencyManager::get<TextureCache>()->setFrameBufferSize(fromGlm(renderSize));
|
||||
|
||||
// Possible change in aspect ratio
|
||||
_myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()),
|
||||
|
@ -1134,7 +1134,7 @@ void Application::resizeGL() {
|
|||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
|
||||
auto uiSize = displayPlugin->getCanvasSize();
|
||||
auto uiSize = displayPlugin->getRecommendedUiSize();
|
||||
if (offscreenUi->getWindow()->geometry().size() != fromGlm(uiSize)) {
|
||||
offscreenUi->resize(fromGlm(uiSize));
|
||||
_offscreenContext->makeCurrent();
|
||||
|
@ -1974,11 +1974,16 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
|||
}
|
||||
|
||||
bool Application::mouseOnScreen() const {
|
||||
return getActiveDisplayPlugin()->isMouseOnScreen();
|
||||
glm::ivec2 mousePosition = getTrueMouse();
|
||||
return (glm::all(glm::greaterThanEqual(mousePosition, glm::ivec2(0))) &&
|
||||
glm::all(glm::lessThanEqual(mousePosition, glm::ivec2(getCanvasSize()))));
|
||||
}
|
||||
|
||||
ivec2 Application::getMouseDragStarted() const {
|
||||
return getActiveDisplayPlugin()->trueMouseToUiMouse(getTrueMouseDragStarted());
|
||||
if (isHMDMode()) {
|
||||
return _compositor.screenToOverlay(getTrueMouseDragStarted());
|
||||
}
|
||||
return getTrueMouseDragStarted();
|
||||
}
|
||||
|
||||
ivec2 Application::getMouse() const {
|
||||
|
@ -4740,11 +4745,11 @@ glm::quat Application::getHeadOrientation() const {
|
|||
}
|
||||
|
||||
glm::uvec2 Application::getCanvasSize() const {
|
||||
return getActiveDisplayPlugin()->getCanvasSize();
|
||||
return getActiveDisplayPlugin()->getRecommendedUiSize();
|
||||
}
|
||||
|
||||
QSize Application::getDeviceSize() const {
|
||||
return getActiveDisplayPlugin()->getDeviceSize();
|
||||
return fromGlm(getActiveDisplayPlugin()->getRecommendedRenderSize());
|
||||
}
|
||||
|
||||
PickRay Application::computePickRay() const {
|
||||
|
@ -4756,7 +4761,7 @@ bool Application::isThrottleRendering() const {
|
|||
}
|
||||
|
||||
ivec2 Application::getTrueMouse() const {
|
||||
return getActiveDisplayPlugin()->getTrueMousePosition();
|
||||
return toGlm(_glWindow->mapFromGlobal(QCursor::pos()));
|
||||
}
|
||||
|
||||
bool Application::hasFocus() const {
|
||||
|
@ -4830,7 +4835,7 @@ void Application::updateDisplayMode() {
|
|||
} else {
|
||||
DependencyManager::get<OffscreenUi>()->setProxyWindow(nullptr);
|
||||
}
|
||||
offscreenUi->resize(fromGlm(newDisplayPlugin->getCanvasSize()));
|
||||
offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize()));
|
||||
_offscreenContext->makeCurrent();
|
||||
}
|
||||
|
||||
|
|
|
@ -134,6 +134,13 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
|||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
renderArgs->_context->syncCache();
|
||||
fboViewport(_overlayFramebuffer);
|
||||
}
|
||||
|
||||
void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||
}
|
||||
|
||||
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
|
||||
#include <gpu/Texture.h>
|
||||
class QOpenGLFramebufferObject;
|
||||
class QOpenGLTexture;
|
||||
|
||||
class PalmData;
|
||||
|
||||
// Handles the drawing of the overlays to the screen
|
||||
// TODO, move divide up the rendering, displaying and input handling
|
||||
|
|
|
@ -7,8 +7,3 @@
|
|||
//
|
||||
#include "DisplayPlugin.h"
|
||||
|
||||
bool DisplayPlugin::isMouseOnScreen() const {
|
||||
glm::ivec2 mousePosition = getTrueMousePosition();
|
||||
return (glm::all(glm::greaterThanEqual(mousePosition, glm::ivec2(0))) &&
|
||||
glm::all(glm::lessThanEqual(mousePosition, glm::ivec2(getCanvasSize()))));
|
||||
}
|
||||
|
|
|
@ -82,40 +82,15 @@ public:
|
|||
|
||||
// Does the rendering surface have current focus?
|
||||
virtual bool hasFocus() const = 0;
|
||||
// The size of the rendering surface
|
||||
virtual QSize getDeviceSize() const = 0;
|
||||
|
||||
// The size of the rendering target (may be larger than the device size due to distortion)
|
||||
virtual QSize getRecommendedFramebufferSize() const { return getDeviceSize(); }
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const = 0;
|
||||
|
||||
// The size of the window (differs from the framebuffers size in instances like Retina macs)
|
||||
virtual glm::ivec2 getCanvasSize() const = 0;
|
||||
|
||||
// The window for the surface, used for event interception. May be null.
|
||||
virtual QWindow* getWindow() const = 0;
|
||||
|
||||
virtual void installEventFilter(QObject* filter) {}
|
||||
virtual void removeEventFilter(QObject* filter) {}
|
||||
|
||||
// The mouse position relative to the window (or proxy window) surface
|
||||
virtual glm::ivec2 getTrueMousePosition() const = 0;
|
||||
|
||||
// The mouse position relative to the UI elements
|
||||
virtual glm::ivec2 getUiMousePosition() const {
|
||||
return trueMouseToUiMouse(getTrueMousePosition());
|
||||
// The size of the UI
|
||||
virtual glm::uvec2 getRecommendedUiSize() const {
|
||||
return getRecommendedRenderSize();
|
||||
}
|
||||
|
||||
virtual std::function<QPointF(const QPointF&)> getMouseTranslator() { return [](const QPointF& p) { return p; }; };
|
||||
|
||||
// Convert from screen mouse coordinates to UI mouse coordinates
|
||||
virtual glm::ivec2 trueMouseToUiMouse(const glm::ivec2 & position) const { return position; };
|
||||
|
||||
virtual PickRay computePickRay(const glm::vec2 & pos) const {
|
||||
// FIXME make pure virtual
|
||||
return PickRay();
|
||||
};
|
||||
virtual bool isMouseOnScreen() const;
|
||||
|
||||
|
||||
// Stereo specific methods
|
||||
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const {
|
||||
return baseProjection;
|
||||
|
@ -138,7 +113,14 @@ public:
|
|||
virtual void abandonCalibration() {}
|
||||
virtual void resetSensors() {}
|
||||
virtual float devicePixelRatio() { return 1.0; }
|
||||
|
||||
|
||||
|
||||
// The window for the surface, used for event interception. May be null.
|
||||
virtual QWindow* getWindow() const = 0;
|
||||
|
||||
virtual void installEventFilter(QObject* filter) {}
|
||||
virtual void removeEventFilter(QObject* filter) {}
|
||||
|
||||
signals:
|
||||
void recommendedFramebufferSizeChanged(const QSize & size);
|
||||
void requestRender();
|
||||
|
|
|
@ -35,7 +35,7 @@ void MainWindowOpenGLDisplayPlugin::display(
|
|||
|
||||
using namespace oglplus;
|
||||
glClearColor(0, 1, 0, 1);
|
||||
uvec2 size = toGlm(getDeviceSize());
|
||||
uvec2 size = toGlm(_window->size());
|
||||
Context::Viewport(size.x, size.y);
|
||||
Context::Clear().ColorBuffer();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
|
|
@ -15,30 +15,14 @@ const QString & NullDisplayPlugin::getName() const {
|
|||
return NAME;
|
||||
}
|
||||
|
||||
QSize NullDisplayPlugin::getDeviceSize() const {
|
||||
return QSize(100, 100);
|
||||
}
|
||||
|
||||
glm::ivec2 NullDisplayPlugin::getCanvasSize() const {
|
||||
return glm::ivec2(100, 100);
|
||||
glm::uvec2 NullDisplayPlugin::getRecommendedRenderSize() const {
|
||||
return glm::uvec2(100, 100);
|
||||
}
|
||||
|
||||
bool NullDisplayPlugin::hasFocus() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
glm::ivec2 NullDisplayPlugin::getTrueMousePosition() const {
|
||||
return glm::ivec2();
|
||||
}
|
||||
|
||||
PickRay NullDisplayPlugin::computePickRay(const glm::vec2 & pos) const {
|
||||
return PickRay();
|
||||
}
|
||||
|
||||
bool NullDisplayPlugin::isMouseOnScreen() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
QWindow* NullDisplayPlugin::getWindow() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,8 @@ public:
|
|||
void activate(PluginContainer * container) override;
|
||||
void deactivate() override;
|
||||
|
||||
virtual QSize getDeviceSize() const override;
|
||||
virtual glm::ivec2 getCanvasSize() const override;
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const override;
|
||||
virtual bool hasFocus() const override;
|
||||
// virtual glm::ivec2 getRelativeMousePosition() const override;
|
||||
virtual glm::ivec2 getTrueMousePosition() const override;
|
||||
virtual PickRay computePickRay(const glm::vec2 & pos) const override;
|
||||
virtual bool isMouseOnScreen() const override;
|
||||
virtual QWindow* getWindow() const override;
|
||||
virtual void preRender() override;
|
||||
virtual void preDisplay() override;
|
||||
|
|
|
@ -105,7 +105,7 @@ void OpenGLDisplayPlugin::display(
|
|||
GLuint finalTexture, const glm::uvec2& sceneSize) {
|
||||
using namespace oglplus;
|
||||
|
||||
uvec2 size = toGlm(getDeviceSize());
|
||||
uvec2 size = getRecommendedRenderSize();
|
||||
Context::Viewport(size.x, size.y);
|
||||
Context::Clear().ColorBuffer();
|
||||
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2015/05/29
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "WidgetOpenGLDisplayPlugin.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <GlWindow.h>
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLDebugLogger>
|
||||
#include <QWidget>
|
||||
#include <QGLContext>
|
||||
#include <QGLWidget>
|
||||
#include "plugins/PluginContainer.h"
|
||||
#if 0
|
||||
WidgetOpenGLDisplayPlugin::WidgetOpenGLDisplayPlugin() {
|
||||
}
|
||||
|
||||
const QString WidgetOpenGLDisplayPlugin::NAME("QWidget 2D Renderer");
|
||||
|
||||
const QString & WidgetOpenGLDisplayPlugin::getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
class CustomOpenGLWidget : public QGLWidget {
|
||||
public:
|
||||
explicit CustomOpenGLWidget(const QGLFormat& format, QWidget* parent = 0,
|
||||
const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0) : QGLWidget(format, parent, shareWidget, f) {
|
||||
setAutoBufferSwap(false);
|
||||
}
|
||||
protected:
|
||||
|
||||
void paintGL() { }
|
||||
void resizeGL() {}
|
||||
void initializeGL() {}
|
||||
};
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::activate(PluginContainer * container) {
|
||||
OpenGLDisplayPlugin::activate(container);
|
||||
|
||||
Q_ASSERT(nullptr == _widget);
|
||||
_widget = new CustomOpenGLWidget(QGL::NoDepthBuffer | QGL::NoStencilBuffer);
|
||||
QOpenGLContext * sourceContext = QOpenGLContext::currentContext();
|
||||
QOpenGLContext * newContext = new QOpenGLContext();
|
||||
_widget->setContext(
|
||||
QGLContext::fromOpenGLContext(newContext),
|
||||
QGLContext::fromOpenGLContext(sourceContext));
|
||||
|
||||
QMainWindow* mainWindow = container->getAppMainWindow();
|
||||
mainWindow->setCentralWidget(_widget);
|
||||
|
||||
makeCurrent();
|
||||
customizeContext(container);
|
||||
|
||||
_widget->installEventFilter(this);
|
||||
}
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::deactivate() {
|
||||
OpenGLDisplayPlugin::deactivate();
|
||||
_widget->deleteLater();
|
||||
_widget = nullptr;
|
||||
}
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::makeCurrent() {
|
||||
_widget->makeCurrent();
|
||||
|
||||
}
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::doneCurrent() {
|
||||
_widget->doneCurrent();
|
||||
}
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::swapBuffers() {
|
||||
_widget->swapBuffers();
|
||||
}
|
||||
|
||||
glm::ivec2 WidgetOpenGLDisplayPlugin::getTrueMousePosition() const {
|
||||
return toGlm(_widget->mapFromGlobal(QCursor::pos()));
|
||||
}
|
||||
|
||||
QSize WidgetOpenGLDisplayPlugin::getDeviceSize() const {
|
||||
return _widget->geometry().size() * _widget->devicePixelRatio();
|
||||
}
|
||||
|
||||
glm::ivec2 WidgetOpenGLDisplayPlugin::getCanvasSize() const {
|
||||
return toGlm(_widget->geometry().size());
|
||||
}
|
||||
|
||||
bool WidgetOpenGLDisplayPlugin::hasFocus() const {
|
||||
return _widget->hasFocus();
|
||||
}
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::installEventFilter(QObject* filter) {
|
||||
_widget->installEventFilter(filter);
|
||||
}
|
||||
|
||||
void WidgetOpenGLDisplayPlugin::removeEventFilter(QObject* filter) {
|
||||
_widget->removeEventFilter(filter);
|
||||
}
|
||||
|
||||
QWindow* WidgetOpenGLDisplayPlugin::getWindow() const {
|
||||
return _widget->windowHandle();
|
||||
}
|
||||
#endif
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2015/05/29
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "OpenGLDisplayPlugin.h"
|
||||
|
||||
class QGLWidget;
|
||||
class QOpenGLDebugLogger;
|
||||
class WidgetOpenGLDisplayPlugin : public OpenGLDisplayPlugin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static const QString NAME;
|
||||
|
||||
WidgetOpenGLDisplayPlugin();
|
||||
|
||||
virtual const QString & getName() const override;
|
||||
virtual glm::ivec2 getTrueMousePosition() const override;
|
||||
virtual QSize getDeviceSize() const override;
|
||||
virtual glm::ivec2 getCanvasSize() const override;
|
||||
virtual bool hasFocus() const override;
|
||||
virtual QWindow* getWindow() const override;
|
||||
|
||||
virtual void activate(PluginContainer * container) override;
|
||||
virtual void deactivate() override;
|
||||
|
||||
virtual void installEventFilter(QObject* filter) override;
|
||||
virtual void removeEventFilter(QObject* filter) override;
|
||||
|
||||
protected:
|
||||
virtual void makeCurrent() override;
|
||||
virtual void doneCurrent() override;
|
||||
virtual void swapBuffers() override;
|
||||
|
||||
QGLWidget* _widget{ nullptr };
|
||||
};
|
|
@ -13,15 +13,11 @@
|
|||
WindowOpenGLDisplayPlugin::WindowOpenGLDisplayPlugin() {
|
||||
}
|
||||
|
||||
glm::ivec2 WindowOpenGLDisplayPlugin::getTrueMousePosition() const {
|
||||
return toGlm(_window->mapFromGlobal(QCursor::pos()));
|
||||
glm::uvec2 WindowOpenGLDisplayPlugin::getRecommendedRenderSize() const {
|
||||
return toGlm(_window->geometry().size() * _window->devicePixelRatio());
|
||||
}
|
||||
|
||||
QSize WindowOpenGLDisplayPlugin::getDeviceSize() const {
|
||||
return _window->geometry().size() * _window->devicePixelRatio();
|
||||
}
|
||||
|
||||
glm::ivec2 WindowOpenGLDisplayPlugin::getCanvasSize() const {
|
||||
glm::uvec2 WindowOpenGLDisplayPlugin::getRecommendedUiSize() const {
|
||||
return toGlm(_window->geometry().size());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,8 @@ class WindowOpenGLDisplayPlugin : public OpenGLDisplayPlugin {
|
|||
public:
|
||||
WindowOpenGLDisplayPlugin();
|
||||
|
||||
virtual glm::ivec2 getTrueMousePosition() const override;
|
||||
virtual QSize getDeviceSize() const override;
|
||||
virtual glm::ivec2 getCanvasSize() const override;
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const override;
|
||||
virtual glm::uvec2 getRecommendedUiSize() const override;
|
||||
virtual bool hasFocus() const override;
|
||||
virtual QWindow* getWindow() const override;
|
||||
virtual void activate(PluginContainer * container) override;
|
||||
|
|
|
@ -26,7 +26,7 @@ void OculusBaseDisplayPlugin::activate(PluginContainer * container) {
|
|||
_eyeOffsets[eye] = erd.HmdToEyeViewOffset;
|
||||
eyeSizes[eye] = toGlm(ovrHmd_GetFovTextureSize(_hmd, eye, erd.Fov, 1.0f));
|
||||
});
|
||||
_desiredFramebufferSize = QSize(
|
||||
_desiredFramebufferSize = uvec2(
|
||||
eyeSizes[0].x + eyeSizes[1].x,
|
||||
std::max(eyeSizes[0].y, eyeSizes[1].y));
|
||||
|
||||
|
@ -38,7 +38,7 @@ void OculusBaseDisplayPlugin::activate(PluginContainer * container) {
|
|||
MainWindowOpenGLDisplayPlugin::activate(container);
|
||||
}
|
||||
|
||||
QSize OculusBaseDisplayPlugin::getRecommendedFramebufferSize() const {
|
||||
uvec2 OculusBaseDisplayPlugin::getRecommendedRenderSize() const {
|
||||
return _desiredFramebufferSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ public:
|
|||
virtual glm::mat4 getModelview(Eye eye, const glm::mat4& baseModelview) const override;
|
||||
virtual void activate(PluginContainer * container) override;
|
||||
virtual void preRender() override;
|
||||
virtual QSize getRecommendedFramebufferSize() const override;
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const override;
|
||||
virtual glm::uvec2 getRecommendedUiSize() const override { return uvec2(1920, 1080); }
|
||||
virtual void resetSensors() override;
|
||||
virtual glm::ivec2 getCanvasSize() const override { return ivec2(1920, 1080); }
|
||||
virtual glm::mat4 getEyePose(Eye eye) const override;
|
||||
virtual glm::mat4 getHeadPose() const override;
|
||||
|
||||
|
@ -34,5 +34,5 @@ protected:
|
|||
ovrVector3f _eyeOffsets[2];
|
||||
mat4 _eyeProjections[2];
|
||||
mat4 _compositeEyeProjections[2];
|
||||
QSize _desiredFramebufferSize;
|
||||
uvec2 _desiredFramebufferSize;
|
||||
};
|
||||
|
|
|
@ -209,10 +209,8 @@ void OculusWin32DisplayPlugin::customizeContext(PluginContainer * container) {
|
|||
_mirrorFbo = MirrorFboPtr(new MirrorFramebufferWrapper(_hmd));
|
||||
_mirrorFbo->Init(mirrorSize);
|
||||
|
||||
|
||||
uvec2 swapSize = toGlm(getRecommendedFramebufferSize());
|
||||
_sceneFbo = SwapFboPtr(new SwapFramebufferWrapper(_hmd));
|
||||
_sceneFbo->Init(swapSize);
|
||||
_sceneFbo->Init(getRecommendedRenderSize());
|
||||
|
||||
// We're rendering both eyes to the same texture, so only one of the
|
||||
// pointers is populated
|
||||
|
@ -259,7 +257,7 @@ void OculusWin32DisplayPlugin::display(GLuint finalTexture, const glm::uvec2& sc
|
|||
sceneLayer.RenderPose[eye] = _eyePoses[eye];
|
||||
});
|
||||
|
||||
auto windowSize = toGlm(getDeviceSize());
|
||||
auto windowSize = toGlm(_window->size());
|
||||
|
||||
/*
|
||||
Two alternatives for mirroring to the screen, the first is to copy our own composited
|
||||
|
|
|
@ -79,6 +79,9 @@ void OpenVrDisplayPlugin::activate(PluginContainer * container) {
|
|||
|
||||
_hmd->GetWindowBounds(&_windowPosition.x, &_windowPosition.y, &_windowSize.x, &_windowSize.y);
|
||||
_hmd->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y);
|
||||
// Recommended render target size is per-eye, so double the X size for
|
||||
// left + right eyes
|
||||
_renderTargetSize.x *= 2;
|
||||
openvr_for_each_eye([&](vr::Hmd_Eye eye) {
|
||||
PerEyeData& eyeData = _eyesData[eye];
|
||||
_hmd->GetEyeOutputViewport(eye,
|
||||
|
@ -112,21 +115,18 @@ void OpenVrDisplayPlugin::deactivate() {
|
|||
_compositor = nullptr;
|
||||
}
|
||||
|
||||
QSize OpenVrDisplayPlugin::getRecommendedFramebufferSize() const {
|
||||
return QSize(_renderTargetSize.x * 2, _renderTargetSize.y);
|
||||
uvec2 OpenVrDisplayPlugin::getRecommendedRenderSize() const {
|
||||
return _renderTargetSize;
|
||||
}
|
||||
|
||||
mat4 OpenVrDisplayPlugin::getProjection(Eye eye, const mat4& baseProjection) const {
|
||||
return _eyesData[eye]._projectionMatrix;
|
||||
}
|
||||
|
||||
glm::mat4 OpenVrDisplayPlugin::getModelview(Eye eye, const mat4& baseModelview) const {
|
||||
mat4 OpenVrDisplayPlugin::getModelview(Eye eye, const mat4& baseModelview) const {
|
||||
return baseModelview * _eyesData[eye]._pose;
|
||||
}
|
||||
|
||||
void OpenVrDisplayPlugin::preRender() {
|
||||
}
|
||||
|
||||
void OpenVrDisplayPlugin::resetSensors() {
|
||||
_hmd->ResetSeatedZeroPose();
|
||||
}
|
||||
|
|
|
@ -13,20 +13,19 @@ class OpenVrDisplayPlugin : public MainWindowOpenGLDisplayPlugin {
|
|||
public:
|
||||
virtual bool isSupported() const override;
|
||||
virtual const QString & getName() const override;
|
||||
virtual bool isHmd() const override { return true; }
|
||||
|
||||
virtual void activate(PluginContainer * container) override;
|
||||
virtual void deactivate() override;
|
||||
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const override;
|
||||
virtual glm::uvec2 getRecommendedUiSize() const override { return uvec2(1920, 1080); }
|
||||
|
||||
// Stereo specific methods
|
||||
virtual bool isHmd() const override { return true; }
|
||||
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const override;
|
||||
virtual glm::mat4 getModelview(Eye eye, const glm::mat4& baseModelview) const override;
|
||||
|
||||
virtual void preRender() override;
|
||||
virtual QSize getRecommendedFramebufferSize() const override;
|
||||
virtual void resetSensors() override;
|
||||
|
||||
virtual glm::ivec2 getCanvasSize() const override { return ivec2(1920, 1080); }
|
||||
virtual glm::mat4 getEyePose(Eye eye) const override;
|
||||
virtual glm::mat4 getHeadPose() const override;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ GlWindow::~GlWindow() {
|
|||
|
||||
|
||||
bool GlWindow::makeCurrent() {
|
||||
bool makeCurrentResult = _context->makeCurrent(this);
|
||||
bool makeCurrentResult = _context->makeCurrent(this);
|
||||
Q_ASSERT(makeCurrentResult);
|
||||
QOpenGLContext * currentContext = QOpenGLContext::currentContext();
|
||||
Q_ASSERT(_context == currentContext);
|
||||
|
@ -50,12 +50,9 @@ bool GlWindow::makeCurrent() {
|
|||
_logger = new QOpenGLDebugLogger(this);
|
||||
if (_logger->initialize()) {
|
||||
connect(_logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage& message) {
|
||||
if (message.type() == QOpenGLDebugMessage::Type::ErrorType) {
|
||||
qDebug() << "Error";
|
||||
}
|
||||
qDebug() << message;
|
||||
});
|
||||
//_logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity);
|
||||
_logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity);
|
||||
_logger->startLogging(QOpenGLDebugLogger::LoggingMode::SynchronousLogging);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
void doneCurrent();
|
||||
void swapBuffers();
|
||||
|
||||
QOpenGLContext* _context{ nullptr };
|
||||
private:
|
||||
QOpenGLContext* _context{ nullptr };
|
||||
#ifdef DEBUG
|
||||
QOpenGLDebugLogger* _logger{ nullptr };
|
||||
#endif
|
||||
|
|
|
@ -59,9 +59,6 @@ bool OffscreenGlCanvas::makeCurrent() {
|
|||
_logger = new QOpenGLDebugLogger(this);
|
||||
if (_logger->initialize()) {
|
||||
connect(_logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage& message) {
|
||||
if (message.type() == QOpenGLDebugMessage::Type::ErrorType) {
|
||||
qDebug() << "Error";
|
||||
}
|
||||
qDebug() << message;
|
||||
});
|
||||
_logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity);
|
||||
|
|
Loading…
Reference in a new issue