Fixing naming of GL classes

This commit is contained in:
Brad Davis 2015-11-29 00:42:46 -08:00
parent a94b6667b1
commit 0023c034c4
15 changed files with 65 additions and 62 deletions

View file

@ -78,7 +78,7 @@
#include <ObjectMotionState.h>
#include <OctalCode.h>
#include <OctreeSceneStats.h>
#include <gl/OffscreenGlCanvas.h>
#include <gl/OffscreenGLCanvas.h>
#include <PathUtils.h>
#include <PerfStat.h>
#include <PhysicsEngine.h>
@ -616,7 +616,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
// enable mouse tracking; otherwise, we only get drag events
_glWidget->setMouseTracking(true);
_offscreenContext = new OffscreenGlCanvas();
_offscreenContext = new OffscreenGLCanvas();
_offscreenContext->create(_glWidget->context()->contextHandle());
_offscreenContext->makeCurrent();
initializeGL();

View file

@ -65,7 +65,7 @@
#include "ui/ToolWindow.h"
#include "UndoStackScriptingInterface.h"
class OffscreenGlCanvas;
class OffscreenGLCanvas;
class GLCanvas;
class FaceTracker;
class MainWindow;
@ -421,7 +421,7 @@ private:
bool _dependencyManagerIsSetup;
OffscreenGlCanvas* _offscreenContext { nullptr };
OffscreenGLCanvas* _offscreenContext { nullptr };
DisplayPluginPointer _displayPlugin;
InputPluginList _activeInputPlugins;

View file

@ -10,7 +10,6 @@
#include <QCoreApplication>
#include <gl/Config.h>
#include <gl/GlWindow.h>
#include <GLMHelpers.h>

View file

@ -14,7 +14,6 @@
#include <QMainWindow>
#include <QGLWidget>
#include <GLMHelpers.h>
#include <gl/GlWindow.h>
#include <QEvent>
#include <QResizeEvent>

View file

@ -8,15 +8,6 @@
#include "InterleavedStereoDisplayPlugin.h"
#include <QApplication>
#include <QDesktopWidget>
#include <gl/GlWindow.h>
#include <ViewFrustum.h>
#include <MatrixStack.h>
#include <gpu/GLBackend.h>
static const char * INTERLEAVED_TEXTURED_VS = R"VS(#version 410 core
#pragma line __LINE__
@ -81,4 +72,4 @@ void InterleavedStereoDisplayPlugin::display(
_program->Bind();
Uniform<ivec2>(*_program, "textureSize").SetValue(sceneSize);
WindowOpenGLDisplayPlugin::display(finalTexture, sceneSize);
}
}

View file

@ -7,17 +7,7 @@
//
#include "SideBySideStereoDisplayPlugin.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QScreen>
#include <gl/GlWindow.h>
#include <ViewFrustum.h>
#include <MatrixStack.h>
#include <gpu/GLBackend.h>
#include <plugins/PluginContainer.h>
#include <GLMHelpers.h>
const QString SideBySideStereoDisplayPlugin::NAME("3D TV - Side by Side Stereo");

View file

@ -87,6 +87,11 @@ public:
_recycler = recycler;
}
size_t depth() {
Lock lock(_mutex);
return _submits.size();
}
// Submit a new resource from the producer context
// returns the number of prior submissions that were
// never consumed before becoming available.
@ -124,7 +129,7 @@ public:
}
return result;
}
// If fetch returns a non-zero value, it's the responsibility of the
// client to release it at some point
void release(T t, GLsync readSync = 0) {
@ -175,6 +180,7 @@ private:
// May be called on any thread, but must be inside a locked section
void pop(Deque& deque) {
Lock lock(_mutex);
auto& item = deque.front();
_trash.push_front(item);
deque.pop_front();

View file

@ -45,6 +45,14 @@ void GLWidget::initializeGL() {
setAutoBufferSwap(false);
}
void GLWidget::paintEvent(QPaintEvent* event) {
QWidget::paintEvent(event);
}
void GLWidget::resizeEvent(QResizeEvent* event) {
QWidget::resizeEvent(event);
}
bool GLWidget::event(QEvent* event) {
switch (event->type()) {
case QEvent::MouseMove:

View file

@ -27,6 +27,8 @@ public:
protected:
virtual void initializeGL() override;
virtual bool event(QEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void resizeEvent(QResizeEvent* event) override;
private slots:
virtual bool eventFilter(QObject*, QEvent* event) override;

View file

@ -6,17 +6,18 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "GlWindow.h"
#include "GLWindow.h"
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLDebugLogger>
#include "GLHelpers.h"
GlWindow::GlWindow(QOpenGLContext* shareContext) : GlWindow(getDefaultOpenGlSurfaceFormat(), shareContext) {
void GLWindow::createContext(QOpenGLContext* shareContext) {
createContext(getDefaultOpenGlSurfaceFormat(), shareContext);
}
GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext) {
void GLWindow::createContext(const QSurfaceFormat& format, QOpenGLContext* shareContext) {
setSurfaceType(QSurface::OpenGLSurface);
setFormat(format);
_context = new QOpenGLContext;
@ -27,13 +28,15 @@ GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext) {
_context->create();
}
GlWindow::~GlWindow() {
_context->doneCurrent();
_context->deleteLater();
_context = nullptr;
GLWindow::~GLWindow() {
if (_context) {
_context->doneCurrent();
_context->deleteLater();
_context = nullptr;
}
}
bool GlWindow::makeCurrent() {
bool GLWindow::makeCurrent() {
bool makeCurrentResult = _context->makeCurrent(this);
Q_ASSERT(makeCurrentResult);
@ -49,11 +52,16 @@ bool GlWindow::makeCurrent() {
return makeCurrentResult;
}
void GlWindow::doneCurrent() {
void GLWindow::doneCurrent() {
_context->doneCurrent();
}
void GlWindow::swapBuffers() {
void GLWindow::swapBuffers() {
_context->swapBuffers(this);
}
QOpenGLContext* GLWindow::context() const {
return _context;
}

View file

@ -7,8 +7,8 @@
//
#pragma once
#ifndef hifi_GlWindow_h
#define hifi_GlWindow_h
#ifndef hifi_GLWindow_h
#define hifi_GLWindow_h
#include <mutex>
#include <QtGui/QWindow>
@ -16,14 +16,15 @@
class QOpenGLContext;
class QOpenGLDebugLogger;
class GlWindow : public QWindow {
class GLWindow : public QWindow {
public:
GlWindow(QOpenGLContext* shareContext = nullptr);
GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext = nullptr);
virtual ~GlWindow();
virtual ~GLWindow();
void createContext(QOpenGLContext* shareContext = nullptr);
void createContext(const QSurfaceFormat& format, QOpenGLContext* shareContext = nullptr);
bool makeCurrent();
void doneCurrent();
void swapBuffers();
QOpenGLContext* context() const;
private:
std::once_flag _reportOnce;
QOpenGLContext* _context{ nullptr };

View file

@ -1,5 +1,5 @@
//
// OffscreenGlCanvas.cpp
// OffscreenGLCanvas.cpp
// interface/src/renderer
//
// Created by Bradley Austin Davis on 2014/04/09.
@ -10,7 +10,7 @@
//
#include "OffscreenGlCanvas.h"
#include "OffscreenGLCanvas.h"
#include <QtGui/QOffscreenSurface>
#include <QtGui/QOpenGLDebugLogger>
@ -18,10 +18,10 @@
#include "GLHelpers.h"
OffscreenGlCanvas::OffscreenGlCanvas() : _context(new QOpenGLContext), _offscreenSurface(new QOffscreenSurface){
OffscreenGLCanvas::OffscreenGLCanvas() : _context(new QOpenGLContext), _offscreenSurface(new QOffscreenSurface){
}
OffscreenGlCanvas::~OffscreenGlCanvas() {
OffscreenGLCanvas::~OffscreenGLCanvas() {
#ifdef DEBUG
if (_logger) {
makeCurrent();
@ -32,7 +32,7 @@ OffscreenGlCanvas::~OffscreenGlCanvas() {
_context->doneCurrent();
}
void OffscreenGlCanvas::create(QOpenGLContext* sharedContext) {
void OffscreenGLCanvas::create(QOpenGLContext* sharedContext) {
if (nullptr != sharedContext) {
sharedContext->doneCurrent();
_context->setShareContext(sharedContext);
@ -45,7 +45,7 @@ void OffscreenGlCanvas::create(QOpenGLContext* sharedContext) {
}
bool OffscreenGlCanvas::makeCurrent() {
bool OffscreenGLCanvas::makeCurrent() {
bool result = _context->makeCurrent(_offscreenSurface);
Q_ASSERT(result);
@ -72,7 +72,7 @@ bool OffscreenGlCanvas::makeCurrent() {
return result;
}
void OffscreenGlCanvas::doneCurrent() {
void OffscreenGLCanvas::doneCurrent() {
_context->doneCurrent();
}

View file

@ -1,5 +1,5 @@
//
// OffscreenGlCanvas.h
// OffscreenGLCanvas.h
// interface/src/renderer
//
// Created by Bradley Austin Davis on 2014/04/09.
@ -9,8 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#pragma once
#ifndef hifi_OffscreenGlCanvas_h
#define hifi_OffscreenGlCanvas_h
#ifndef hifi_OffscreenGLCanvas_h
#define hifi_OffscreenGLCanvas_h
#include <mutex>
#include <QObject>
@ -19,10 +19,10 @@ class QOpenGLContext;
class QOffscreenSurface;
class QOpenGLDebugLogger;
class OffscreenGlCanvas : public QObject {
class OffscreenGLCanvas : public QObject {
public:
OffscreenGlCanvas();
~OffscreenGlCanvas();
OffscreenGLCanvas();
~OffscreenGLCanvas();
void create(QOpenGLContext* sharedContext = nullptr);
bool makeCurrent();
void doneCurrent();
@ -40,4 +40,4 @@ protected:
};
#endif // hifi_OffscreenGlCanvas_h
#endif // hifi_OffscreenGLCanvas_h

View file

@ -23,7 +23,7 @@
#include <NumericalConstants.h>
#include "GLEscrow.h"
#include "OffscreenGlCanvas.h"
#include "OffscreenGLCanvas.h"
// FIXME move to threaded rendering with Qt 5.5
//#define QML_THREADED
@ -64,12 +64,12 @@ static const QEvent::Type STOP = QEvent::Type(QEvent::User + 4);
static const QEvent::Type UPDATE = QEvent::Type(QEvent::User + 5);
#endif
class OffscreenQmlRenderer : public OffscreenGlCanvas {
class OffscreenQmlRenderer : public OffscreenGLCanvas {
friend class OffscreenQmlSurface;
public:
OffscreenQmlRenderer(OffscreenQmlSurface* surface, QOpenGLContext* shareContext) : _surface(surface) {
OffscreenGlCanvas::create(shareContext);
OffscreenGLCanvas::create(shareContext);
#ifdef QML_THREADED
// Qt 5.5
_renderControl->prepareThread(_renderThread);

View file

@ -12,7 +12,6 @@
#include <QtWidgets/QMainWindow>
#include <QtOpenGL/QGLWidget>
#include <GLMHelpers.h>
#include <gl/GlWindow.h>
#include <QEvent>
#include <QtGui/QResizeEvent>
#include <QtGui/QOpenGLContext>