Martin Lambers

Remove user-visible dependence on QOpenGLExtraFunctions.

This is now an implementation detail, in preparation of Vulkan support.
......@@ -28,6 +28,8 @@
#include <QGuiApplication>
#include <QTimer>
#include <QElapsedTimer>
#include <QOpenGLContext>
#include <QOpenGLExtraFunctions>
#include "manager.hpp"
#include "event.hpp"
......@@ -101,7 +103,6 @@ QVRManager::QVRManager(int& argc, char* argv[]) :
_deviceLastStates(),
_observers(),
_masterWindow(NULL),
_masterGLContext(NULL),
_windows(),
_thisProcess(NULL),
_slaveProcesses(),
......@@ -667,15 +668,14 @@ bool QVRManager::init(QVRApp* app, bool preferCustomNavigation)
return false;
}
}
_masterGLContext = new QOpenGLContext();
QVR_INFO(" master window...");
_masterWindow = new QVRWindow(_masterGLContext, 0, -1);
_masterWindow = new QVRWindow(0, 0, -1);
if (!_masterWindow->isValid())
return false;
for (int w = 0; w < processConfig().windowConfigs().size(); w++) {
QVR_INFO(" window %d...", w);
QVRObserver* observer = _observers.at(windowConfig(_processIndex, w).observerIndex());
QVRWindow* window = new QVRWindow(_masterGLContext, observer, w);
QVRWindow* window = new QVRWindow(_masterWindow, observer, w);
if (!window->isValid())
return false;
_windows.append(window);
......@@ -1101,7 +1101,7 @@ void QVRManager::render()
_masterWindow->winContext()->makeCurrent(_masterWindow);
#ifdef GL_FRAMEBUFFER_SRGB
_masterWindow->glEnable(GL_FRAMEBUFFER_SRGB);
_masterWindow->_gl->glEnable(GL_FRAMEBUFFER_SRGB);
#endif
QVR_FIREHOSE(" ... preRenderProcess()");
......@@ -1151,7 +1151,7 @@ void QVRManager::render()
* the current scene, otherwise artefacts are displayed when the window
* threads render them. It seems that glFlush() is not enough for all
* OpenGL implementations; to be safe, we use glFinish(). */
_masterWindow->glFinish();
_masterWindow->_gl->glFinish();
for (int w = 0; w < _windows.size(); w++) {
QVR_FIREHOSE(" ... renderToScreen(%d)", w);
_windows[w]->renderToScreen();
......
......@@ -191,7 +191,6 @@
template <typename T> class QList;
class QTimer;
class QOpenGLContext;
class QKeyEvent;
class QMouseEvent;
class QWheelEvent;
......@@ -285,7 +284,6 @@ private:
QList<int> _observerTrackingDevices0;
QList<int> _observerTrackingDevices1;
QVRWindow* _masterWindow;
QOpenGLContext* _masterGLContext;
QList<QVRWindow*> _windows;
QVRProcess* _thisProcess;
QList<QVRProcess*> _slaveProcesses;
......
/*
* Copyright (C) 2016, 2017 Computer Graphics Group, University of Siegen
* Copyright (C) 2016, 2017, 2018 Computer Graphics Group, University of Siegen
* Written by Martin Lambers <martin.lambers@uni-siegen.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
......@@ -25,7 +25,6 @@
#define QVR_WINDOW_HPP
#include <QWindow>
#include <QOpenGLExtraFunctions>
#include "config.hpp"
#include "rendercontext.hpp"
......@@ -34,6 +33,7 @@ class QVRObserver;
class QVRWindowThread;
class QOpenGLShaderProgram;
class QOpenGLContext;
class QOpenGLExtraFunctions;
class QStringList;
/*!
......@@ -62,7 +62,7 @@ class QStringList;
*
* An window is configured via \a QVRWindowConfig.
*/
class QVRWindow : public QWindow, protected QOpenGLExtraFunctions
class QVRWindow : public QWindow
{
private:
bool _isValid;
......@@ -78,6 +78,7 @@ private:
void (*_outputPluginExitFunc)(QVRWindow*);
void (*_outputPluginFunc)(QVRWindow*, const QVRRenderContext&, const unsigned int*);
QOpenGLContext* _winContext;
QOpenGLExtraFunctions* _gl;
QVRRenderContext _renderContext;
bool isMaster() const;
......@@ -120,11 +121,15 @@ protected:
public:
/*! \brief Constructor.
* @param masterContext The master OpenGL context of the process
* @param masterWindow Pointer to master window
* @param observer The observer to provide a view for
* @param windowIndex The index of this window in this process
*
* The first window has to be created with parameters (0, 0, -1), and it
* will be the hidden master window. All other windows get a pointer to it
* on creation time.
*/
QVRWindow(QOpenGLContext* masterContext, QVRObserver* observer, int windowIndex);
QVRWindow(QVRWindow* masterWindow, QVRObserver* observer, int windowIndex);
/*! \brief Destructor. */
virtual ~QVRWindow();
......