mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
commit
3240c1dbfe
5 changed files with 11 additions and 10 deletions
|
@ -45,7 +45,7 @@
|
||||||
#include <QtNetwork/QNetworkDiskCache>
|
#include <QtNetwork/QNetworkDiskCache>
|
||||||
|
|
||||||
#include <gl/Config.h>
|
#include <gl/Config.h>
|
||||||
#include <QtGui/QOpenGLContext>
|
#include <QOpenGLContextWrapper.h>
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
|
@ -1397,13 +1397,13 @@ void Application::paintGL() {
|
||||||
_lockedFramebufferMap[finalTexture] = scratchFramebuffer;
|
_lockedFramebufferMap[finalTexture] = scratchFramebuffer;
|
||||||
|
|
||||||
uint64_t displayStart = usecTimestampNow();
|
uint64_t displayStart = usecTimestampNow();
|
||||||
Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext());
|
Q_ASSERT(isCurrentContext(_offscreenContext->getContext()));
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(__FUNCTION__ "/pluginSubmitScene");
|
PROFILE_RANGE(__FUNCTION__ "/pluginSubmitScene");
|
||||||
PerformanceTimer perfTimer("pluginSubmitScene");
|
PerformanceTimer perfTimer("pluginSubmitScene");
|
||||||
displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size));
|
displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size));
|
||||||
}
|
}
|
||||||
Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext());
|
Q_ASSERT(isCurrentContext(_offscreenContext->getContext()));
|
||||||
|
|
||||||
uint64_t displayEnd = usecTimestampNow();
|
uint64_t displayEnd = usecTimestampNow();
|
||||||
const float displayPeriodUsec = (float)(displayEnd - displayStart); // usecs
|
const float displayPeriodUsec = (float)(displayEnd - displayStart); // usecs
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
#include <QtOpenGL/QGLWidget>
|
#include <QtOpenGL/QGLWidget>
|
||||||
#include <QtGui/QOpenGLContext>
|
|
||||||
#include <QtGui/QImage>
|
#include <QtGui/QImage>
|
||||||
|
|
||||||
#include <gl/GLWidget.h>
|
#include <gl/GLWidget.h>
|
||||||
|
@ -46,7 +45,6 @@ public:
|
||||||
// Extra code because of the widget 'wrapper' context
|
// Extra code because of the widget 'wrapper' context
|
||||||
_context = context;
|
_context = context;
|
||||||
_context->moveToThread(this);
|
_context->moveToThread(this);
|
||||||
_context->contextHandle()->moveToThread(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void run() override {
|
virtual void run() override {
|
||||||
|
@ -57,7 +55,6 @@ public:
|
||||||
Lock lock(_mutex);
|
Lock lock(_mutex);
|
||||||
// Move the context to the main thread
|
// Move the context to the main thread
|
||||||
_context->moveToThread(qApp->thread());
|
_context->moveToThread(qApp->thread());
|
||||||
_context->contextHandle()->moveToThread(qApp->thread());
|
|
||||||
_pendingMainThreadOperation = false;
|
_pendingMainThreadOperation = false;
|
||||||
// Release the main thread to do it's action
|
// Release the main thread to do it's action
|
||||||
_condition.notify_one();
|
_condition.notify_one();
|
||||||
|
@ -104,7 +101,6 @@ public:
|
||||||
|
|
||||||
_context->doneCurrent();
|
_context->doneCurrent();
|
||||||
_context->moveToThread(qApp->thread());
|
_context->moveToThread(qApp->thread());
|
||||||
_context->contextHandle()->moveToThread(qApp->thread());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void withMainThreadContext(std::function<void()> f) {
|
void withMainThreadContext(std::function<void()> f) {
|
||||||
|
@ -120,7 +116,6 @@ public:
|
||||||
|
|
||||||
// Move the context back to the presentation thread
|
// Move the context back to the presentation thread
|
||||||
_context->moveToThread(this);
|
_context->moveToThread(this);
|
||||||
_context->contextHandle()->moveToThread(this);
|
|
||||||
|
|
||||||
// restore control of the context to the presentation thread and signal
|
// restore control of the context to the presentation thread and signal
|
||||||
// the end of the operation
|
// the end of the operation
|
||||||
|
|
|
@ -68,8 +68,8 @@ public:
|
||||||
virtual bool contains(const glm::vec3& point) const override;
|
virtual bool contains(const glm::vec3& point) const override;
|
||||||
|
|
||||||
// these are in the frame of this object
|
// these are in the frame of this object
|
||||||
virtual glm::quat getJointRotation(int index) const;
|
virtual glm::quat getJointRotation(int index) const override;
|
||||||
virtual glm::vec3 getJointTranslation(int index) const;
|
virtual glm::vec3 getJointTranslation(int index) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void remapTextures();
|
void remapTextures();
|
||||||
|
|
|
@ -37,4 +37,8 @@ bool QOpenGLContextWrapper::makeCurrent(QSurface* surface) {
|
||||||
|
|
||||||
void QOpenGLContextWrapper::doneCurrent() {
|
void QOpenGLContextWrapper::doneCurrent() {
|
||||||
_context->doneCurrent();
|
_context->doneCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isCurrentContext(QOpenGLContext* context) {
|
||||||
|
return QOpenGLContext::currentContext() == context;
|
||||||
}
|
}
|
|
@ -30,4 +30,6 @@ private:
|
||||||
QOpenGLContext* _context { nullptr };
|
QOpenGLContext* _context { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool isCurrentContext(QOpenGLContext* context);
|
||||||
|
|
||||||
#endif // hifi_QOpenGLContextWrapper_h
|
#endif // hifi_QOpenGLContextWrapper_h
|
Loading…
Reference in a new issue