Merge remote-tracking branch 'upstream/plugins' into sam/vive-hand-controllers

This commit is contained in:
Sam Gondelman 2015-06-30 10:37:06 -07:00
commit aaf84b47f3
23 changed files with 68 additions and 266 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View file

@ -1124,11 +1124,11 @@ void Application::resizeGL() {
// Set the desired FBO texture size. If it hasn't changed, this does nothing. // Set the desired FBO texture size. If it hasn't changed, this does nothing.
// Otherwise, it must rebuild the FBOs // Otherwise, it must rebuild the FBOs
QSize framebufferSize = getActiveDisplayPlugin()->getRecommendedFramebufferSize(); uvec2 framebufferSize = getActiveDisplayPlugin()->getRecommendedRenderSize();
QSize renderSize = framebufferSize * getRenderResolutionScale(); uvec2 renderSize = uvec2(vec2(framebufferSize) * getRenderResolutionScale());
if (_renderResolution != toGlm(renderSize)) { if (_renderResolution != renderSize) {
_renderResolution = toGlm(renderSize); _renderResolution = renderSize;
DependencyManager::get<TextureCache>()->setFrameBufferSize(renderSize); DependencyManager::get<TextureCache>()->setFrameBufferSize(fromGlm(renderSize));
// Possible change in aspect ratio // Possible change in aspect ratio
_myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()), _myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()),
@ -1137,7 +1137,7 @@ void Application::resizeGL() {
auto offscreenUi = DependencyManager::get<OffscreenUi>(); auto offscreenUi = DependencyManager::get<OffscreenUi>();
auto uiSize = displayPlugin->getCanvasSize(); auto uiSize = displayPlugin->getRecommendedUiSize();
if (offscreenUi->getWindow()->geometry().size() != fromGlm(uiSize)) { if (offscreenUi->getWindow()->geometry().size() != fromGlm(uiSize)) {
offscreenUi->resize(fromGlm(uiSize)); offscreenUi->resize(fromGlm(uiSize));
_offscreenContext->makeCurrent(); _offscreenContext->makeCurrent();
@ -1978,11 +1978,16 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
} }
bool Application::mouseOnScreen() const { 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 { ivec2 Application::getMouseDragStarted() const {
return getActiveDisplayPlugin()->trueMouseToUiMouse(getTrueMouseDragStarted()); if (isHMDMode()) {
return _compositor.screenToOverlay(getTrueMouseDragStarted());
}
return getTrueMouseDragStarted();
} }
ivec2 Application::getMouse() const { ivec2 Application::getMouse() const {
@ -4745,11 +4750,11 @@ glm::quat Application::getHeadOrientation() const {
} }
glm::uvec2 Application::getCanvasSize() const { glm::uvec2 Application::getCanvasSize() const {
return getActiveDisplayPlugin()->getCanvasSize(); return getActiveDisplayPlugin()->getRecommendedUiSize();
} }
QSize Application::getDeviceSize() const { QSize Application::getDeviceSize() const {
return getActiveDisplayPlugin()->getDeviceSize(); return fromGlm(getActiveDisplayPlugin()->getRecommendedRenderSize());
} }
PickRay Application::computePickRay() const { PickRay Application::computePickRay() const {
@ -4761,7 +4766,7 @@ bool Application::isThrottleRendering() const {
} }
ivec2 Application::getTrueMouse() const { ivec2 Application::getTrueMouse() const {
return getActiveDisplayPlugin()->getTrueMousePosition(); return toGlm(_glWindow->mapFromGlobal(QCursor::pos()));
} }
bool Application::hasFocus() const { bool Application::hasFocus() const {
@ -4835,7 +4840,7 @@ void Application::updateDisplayMode() {
} else { } else {
DependencyManager::get<OffscreenUi>()->setProxyWindow(nullptr); DependencyManager::get<OffscreenUi>()->setProxyWindow(nullptr);
} }
offscreenUi->resize(fromGlm(newDisplayPlugin->getCanvasSize())); offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize()));
_offscreenContext->makeCurrent(); _offscreenContext->makeCurrent();
} }

View file

@ -134,6 +134,13 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPopMatrix(); glPopMatrix();
glMatrixMode(GL_MODELVIEW);
renderArgs->_context->syncCache();
fboViewport(_overlayFramebuffer);
}
void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
} }
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) { void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {

View file

@ -14,9 +14,6 @@
#include <gpu/Texture.h> #include <gpu/Texture.h>
class QOpenGLFramebufferObject; class QOpenGLFramebufferObject;
class QOpenGLTexture;
class PalmData;
// Handles the drawing of the overlays to the screen // Handles the drawing of the overlays to the screen
// TODO, move divide up the rendering, displaying and input handling // TODO, move divide up the rendering, displaying and input handling

View file

@ -7,8 +7,3 @@
// //
#include "DisplayPlugin.h" #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()))));
}

View file

@ -82,40 +82,15 @@ public:
// Does the rendering surface have current focus? // Does the rendering surface have current focus?
virtual bool hasFocus() const = 0; 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) // 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) // The size of the UI
virtual glm::ivec2 getCanvasSize() const = 0; virtual glm::uvec2 getRecommendedUiSize() const {
return getRecommendedRenderSize();
// 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());
} }
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 // Stereo specific methods
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const { virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const {
return baseProjection; return baseProjection;
@ -138,7 +113,14 @@ public:
virtual void abandonCalibration() {} virtual void abandonCalibration() {}
virtual void resetSensors() {} virtual void resetSensors() {}
virtual float devicePixelRatio() { return 1.0; } 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: signals:
void recommendedFramebufferSizeChanged(const QSize & size); void recommendedFramebufferSizeChanged(const QSize & size);
void requestRender(); void requestRender();

View file

@ -35,7 +35,7 @@ void MainWindowOpenGLDisplayPlugin::display(
using namespace oglplus; using namespace oglplus;
glClearColor(0, 1, 0, 1); glClearColor(0, 1, 0, 1);
uvec2 size = toGlm(getDeviceSize()); uvec2 size = toGlm(_window->size());
Context::Viewport(size.x, size.y); Context::Viewport(size.x, size.y);
Context::Clear().ColorBuffer(); Context::Clear().ColorBuffer();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);

View file

@ -15,30 +15,14 @@ const QString & NullDisplayPlugin::getName() const {
return NAME; return NAME;
} }
QSize NullDisplayPlugin::getDeviceSize() const { glm::uvec2 NullDisplayPlugin::getRecommendedRenderSize() const {
return QSize(100, 100); return glm::uvec2(100, 100);
}
glm::ivec2 NullDisplayPlugin::getCanvasSize() const {
return glm::ivec2(100, 100);
} }
bool NullDisplayPlugin::hasFocus() const { bool NullDisplayPlugin::hasFocus() const {
return false; 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 { QWindow* NullDisplayPlugin::getWindow() const {
return nullptr; return nullptr;
} }

View file

@ -18,13 +18,8 @@ public:
void activate(PluginContainer * container) override; void activate(PluginContainer * container) override;
void deactivate() override; void deactivate() override;
virtual QSize getDeviceSize() const override; virtual glm::uvec2 getRecommendedRenderSize() const override;
virtual glm::ivec2 getCanvasSize() const override;
virtual bool hasFocus() 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 QWindow* getWindow() const override;
virtual void preRender() override; virtual void preRender() override;
virtual void preDisplay() override; virtual void preDisplay() override;

View file

@ -105,7 +105,7 @@ void OpenGLDisplayPlugin::display(
GLuint finalTexture, const glm::uvec2& sceneSize) { GLuint finalTexture, const glm::uvec2& sceneSize) {
using namespace oglplus; using namespace oglplus;
uvec2 size = toGlm(getDeviceSize()); uvec2 size = getRecommendedRenderSize();
Context::Viewport(size.x, size.y); Context::Viewport(size.x, size.y);
Context::Clear().ColorBuffer(); Context::Clear().ColorBuffer();

View file

@ -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

View file

@ -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 };
};

View file

@ -13,15 +13,11 @@
WindowOpenGLDisplayPlugin::WindowOpenGLDisplayPlugin() { WindowOpenGLDisplayPlugin::WindowOpenGLDisplayPlugin() {
} }
glm::ivec2 WindowOpenGLDisplayPlugin::getTrueMousePosition() const { glm::uvec2 WindowOpenGLDisplayPlugin::getRecommendedRenderSize() const {
return toGlm(_window->mapFromGlobal(QCursor::pos())); return toGlm(_window->geometry().size() * _window->devicePixelRatio());
} }
QSize WindowOpenGLDisplayPlugin::getDeviceSize() const { glm::uvec2 WindowOpenGLDisplayPlugin::getRecommendedUiSize() const {
return _window->geometry().size() * _window->devicePixelRatio();
}
glm::ivec2 WindowOpenGLDisplayPlugin::getCanvasSize() const {
return toGlm(_window->geometry().size()); return toGlm(_window->geometry().size());
} }

View file

@ -17,9 +17,8 @@ class WindowOpenGLDisplayPlugin : public OpenGLDisplayPlugin {
public: public:
WindowOpenGLDisplayPlugin(); WindowOpenGLDisplayPlugin();
virtual glm::ivec2 getTrueMousePosition() const override; virtual glm::uvec2 getRecommendedRenderSize() const override;
virtual QSize getDeviceSize() const override; virtual glm::uvec2 getRecommendedUiSize() const override;
virtual glm::ivec2 getCanvasSize() const override;
virtual bool hasFocus() const override; virtual bool hasFocus() const override;
virtual QWindow* getWindow() const override; virtual QWindow* getWindow() const override;
virtual void activate(PluginContainer * container) override; virtual void activate(PluginContainer * container) override;

View file

@ -26,7 +26,7 @@ void OculusBaseDisplayPlugin::activate(PluginContainer * container) {
_eyeOffsets[eye] = erd.HmdToEyeViewOffset; _eyeOffsets[eye] = erd.HmdToEyeViewOffset;
eyeSizes[eye] = toGlm(ovrHmd_GetFovTextureSize(_hmd, eye, erd.Fov, 1.0f)); eyeSizes[eye] = toGlm(ovrHmd_GetFovTextureSize(_hmd, eye, erd.Fov, 1.0f));
}); });
_desiredFramebufferSize = QSize( _desiredFramebufferSize = uvec2(
eyeSizes[0].x + eyeSizes[1].x, eyeSizes[0].x + eyeSizes[1].x,
std::max(eyeSizes[0].y, eyeSizes[1].y)); std::max(eyeSizes[0].y, eyeSizes[1].y));
@ -38,7 +38,7 @@ void OculusBaseDisplayPlugin::activate(PluginContainer * container) {
MainWindowOpenGLDisplayPlugin::activate(container); MainWindowOpenGLDisplayPlugin::activate(container);
} }
QSize OculusBaseDisplayPlugin::getRecommendedFramebufferSize() const { uvec2 OculusBaseDisplayPlugin::getRecommendedRenderSize() const {
return _desiredFramebufferSize; return _desiredFramebufferSize;
} }

View file

@ -19,9 +19,9 @@ public:
virtual glm::mat4 getModelview(Eye eye, const glm::mat4& baseModelview) const override; virtual glm::mat4 getModelview(Eye eye, const glm::mat4& baseModelview) const override;
virtual void activate(PluginContainer * container) override; virtual void activate(PluginContainer * container) override;
virtual void preRender() 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 void resetSensors() override;
virtual glm::ivec2 getCanvasSize() const override { return ivec2(1920, 1080); }
virtual glm::mat4 getEyePose(Eye eye) const override; virtual glm::mat4 getEyePose(Eye eye) const override;
virtual glm::mat4 getHeadPose() const override; virtual glm::mat4 getHeadPose() const override;
@ -34,5 +34,5 @@ protected:
ovrVector3f _eyeOffsets[2]; ovrVector3f _eyeOffsets[2];
mat4 _eyeProjections[2]; mat4 _eyeProjections[2];
mat4 _compositeEyeProjections[2]; mat4 _compositeEyeProjections[2];
QSize _desiredFramebufferSize; uvec2 _desiredFramebufferSize;
}; };

View file

@ -209,10 +209,8 @@ void OculusWin32DisplayPlugin::customizeContext(PluginContainer * container) {
_mirrorFbo = MirrorFboPtr(new MirrorFramebufferWrapper(_hmd)); _mirrorFbo = MirrorFboPtr(new MirrorFramebufferWrapper(_hmd));
_mirrorFbo->Init(mirrorSize); _mirrorFbo->Init(mirrorSize);
uvec2 swapSize = toGlm(getRecommendedFramebufferSize());
_sceneFbo = SwapFboPtr(new SwapFramebufferWrapper(_hmd)); _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 // We're rendering both eyes to the same texture, so only one of the
// pointers is populated // pointers is populated
@ -259,7 +257,7 @@ void OculusWin32DisplayPlugin::display(GLuint finalTexture, const glm::uvec2& sc
sceneLayer.RenderPose[eye] = _eyePoses[eye]; 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 Two alternatives for mirroring to the screen, the first is to copy our own composited

View file

@ -81,6 +81,9 @@ void OpenVrDisplayPlugin::activate(PluginContainer * container) {
_hmd->GetWindowBounds(&_windowPosition.x, &_windowPosition.y, &_windowSize.x, &_windowSize.y); _hmd->GetWindowBounds(&_windowPosition.x, &_windowPosition.y, &_windowSize.x, &_windowSize.y);
_hmd->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.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) { openvr_for_each_eye([&](vr::Hmd_Eye eye) {
PerEyeData& eyeData = _eyesData[eye]; PerEyeData& eyeData = _eyesData[eye];
_hmd->GetEyeOutputViewport(eye, _hmd->GetEyeOutputViewport(eye,
@ -114,21 +117,18 @@ void OpenVrDisplayPlugin::deactivate() {
_compositor = nullptr; _compositor = nullptr;
} }
QSize OpenVrDisplayPlugin::getRecommendedFramebufferSize() const { uvec2 OpenVrDisplayPlugin::getRecommendedRenderSize() const {
return QSize(_renderTargetSize.x * 2, _renderTargetSize.y); return _renderTargetSize;
} }
mat4 OpenVrDisplayPlugin::getProjection(Eye eye, const mat4& baseProjection) const { mat4 OpenVrDisplayPlugin::getProjection(Eye eye, const mat4& baseProjection) const {
return _eyesData[eye]._projectionMatrix; 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; return baseModelview * _eyesData[eye]._pose;
} }
void OpenVrDisplayPlugin::preRender() {
}
void OpenVrDisplayPlugin::resetSensors() { void OpenVrDisplayPlugin::resetSensors() {
_hmd->ResetSeatedZeroPose(); _hmd->ResetSeatedZeroPose();
} }

View file

@ -13,20 +13,19 @@ class OpenVrDisplayPlugin : public MainWindowOpenGLDisplayPlugin {
public: public:
virtual bool isSupported() const override; virtual bool isSupported() const override;
virtual const QString & getName() const override; virtual const QString & getName() const override;
virtual bool isHmd() const override { return true; }
virtual void activate(PluginContainer * container) override; virtual void activate(PluginContainer * container) override;
virtual void deactivate() override; virtual void deactivate() override;
virtual glm::uvec2 getRecommendedRenderSize() const override;
virtual glm::uvec2 getRecommendedUiSize() const override { return uvec2(1920, 1080); }
// Stereo specific methods // 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 getProjection(Eye eye, const glm::mat4& baseProjection) const override;
virtual glm::mat4 getModelview(Eye eye, const glm::mat4& baseModelview) 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 void resetSensors() override;
virtual glm::ivec2 getCanvasSize() const override { return ivec2(1920, 1080); }
virtual glm::mat4 getEyePose(Eye eye) const override; virtual glm::mat4 getEyePose(Eye eye) const override;
virtual glm::mat4 getHeadPose() const override; virtual glm::mat4 getHeadPose() const override;

View file

@ -41,7 +41,7 @@ GlWindow::~GlWindow() {
bool GlWindow::makeCurrent() { bool GlWindow::makeCurrent() {
bool makeCurrentResult = _context->makeCurrent(this); bool makeCurrentResult = _context->makeCurrent(this);
Q_ASSERT(makeCurrentResult); Q_ASSERT(makeCurrentResult);
QOpenGLContext * currentContext = QOpenGLContext::currentContext(); QOpenGLContext * currentContext = QOpenGLContext::currentContext();
Q_ASSERT(_context == currentContext); Q_ASSERT(_context == currentContext);
@ -50,12 +50,9 @@ bool GlWindow::makeCurrent() {
_logger = new QOpenGLDebugLogger(this); _logger = new QOpenGLDebugLogger(this);
if (_logger->initialize()) { if (_logger->initialize()) {
connect(_logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage& message) { connect(_logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage& message) {
if (message.type() == QOpenGLDebugMessage::Type::ErrorType) {
qDebug() << "Error";
}
qDebug() << message; qDebug() << message;
}); });
//_logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity); _logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity);
_logger->startLogging(QOpenGLDebugLogger::LoggingMode::SynchronousLogging); _logger->startLogging(QOpenGLDebugLogger::LoggingMode::SynchronousLogging);
} }
} }

View file

@ -24,8 +24,8 @@ public:
void doneCurrent(); void doneCurrent();
void swapBuffers(); void swapBuffers();
QOpenGLContext* _context{ nullptr };
private: private:
QOpenGLContext* _context{ nullptr };
#ifdef DEBUG #ifdef DEBUG
QOpenGLDebugLogger* _logger{ nullptr }; QOpenGLDebugLogger* _logger{ nullptr };
#endif #endif

View file

@ -59,9 +59,6 @@ bool OffscreenGlCanvas::makeCurrent() {
_logger = new QOpenGLDebugLogger(this); _logger = new QOpenGLDebugLogger(this);
if (_logger->initialize()) { if (_logger->initialize()) {
connect(_logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage& message) { connect(_logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage& message) {
if (message.type() == QOpenGLDebugMessage::Type::ErrorType) {
qDebug() << "Error";
}
qDebug() << message; qDebug() << message;
}); });
_logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity); _logger->disableMessages(QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::NotificationSeverity);

View file

@ -50,7 +50,7 @@ namespace Cursor {
Manager::Manager() { Manager::Manager() {
ICONS[Icon::DEFAULT] = PathUtils::resourcesPath() + "images/arrow.png"; ICONS[Icon::DEFAULT] = PathUtils::resourcesPath() + "images/arrow.png";
ICONS[Icon::LINK] = PathUtils::resourcesPath() + "images/reticleLink.png"; ICONS[Icon::LINK] = PathUtils::resourcesPath() + "images/link.png";
} }
Manager& Manager::instance() { Manager& Manager::instance() {