mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 12:30:40 +02:00
Merge pull request #7384 from zzmp/fix/bugsplat-1836
Check qml gl context on create
This commit is contained in:
commit
b8929c4416
3 changed files with 19 additions and 7 deletions
|
@ -32,17 +32,25 @@ OffscreenGLCanvas::~OffscreenGLCanvas() {
|
||||||
_context->doneCurrent();
|
_context->doneCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenGLCanvas::create(QOpenGLContext* sharedContext) {
|
bool OffscreenGLCanvas::create(QOpenGLContext* sharedContext) {
|
||||||
if (nullptr != sharedContext) {
|
if (nullptr != sharedContext) {
|
||||||
sharedContext->doneCurrent();
|
sharedContext->doneCurrent();
|
||||||
_context->setShareContext(sharedContext);
|
_context->setShareContext(sharedContext);
|
||||||
}
|
}
|
||||||
_context->setFormat(getDefaultOpenGLSurfaceFormat());
|
_context->setFormat(getDefaultOpenGLSurfaceFormat());
|
||||||
_context->create();
|
if (_context->create()) {
|
||||||
|
_offscreenSurface->setFormat(_context->format());
|
||||||
|
_offscreenSurface->create();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
_offscreenSurface->setFormat(_context->format());
|
qWarning() << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
||||||
_offscreenSurface->create();
|
qWarning() << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||||
|
qWarning() << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
|
||||||
|
qWarning() << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
||||||
|
qWarning() << "Failed to create OffscreenGLCanvas";
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OffscreenGLCanvas::makeCurrent() {
|
bool OffscreenGLCanvas::makeCurrent() {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class OffscreenGLCanvas : public QObject {
|
||||||
public:
|
public:
|
||||||
OffscreenGLCanvas();
|
OffscreenGLCanvas();
|
||||||
~OffscreenGLCanvas();
|
~OffscreenGLCanvas();
|
||||||
void create(QOpenGLContext* sharedContext = nullptr);
|
bool create(QOpenGLContext* sharedContext = nullptr);
|
||||||
bool makeCurrent();
|
bool makeCurrent();
|
||||||
void doneCurrent();
|
void doneCurrent();
|
||||||
QOpenGLContext* getContext() {
|
QOpenGLContext* getContext() {
|
||||||
|
|
|
@ -65,7 +65,11 @@ class OffscreenQmlRenderer : public OffscreenGLCanvas {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
OffscreenQmlRenderer(OffscreenQmlSurface* surface, QOpenGLContext* shareContext) : _surface(surface) {
|
OffscreenQmlRenderer(OffscreenQmlSurface* surface, QOpenGLContext* shareContext) : _surface(surface) {
|
||||||
OffscreenGLCanvas::create(shareContext);
|
if (!OffscreenGLCanvas::create(shareContext)) {
|
||||||
|
static const char* error = "Failed to create OffscreenGLCanvas";
|
||||||
|
qWarning() << error;
|
||||||
|
throw error;
|
||||||
|
};
|
||||||
|
|
||||||
_renderControl = new QMyQuickRenderControl();
|
_renderControl = new QMyQuickRenderControl();
|
||||||
|
|
||||||
|
@ -153,7 +157,7 @@ private:
|
||||||
qWarning("Failed to make context current on render thread");
|
qWarning("Failed to make context current on render thread");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_renderControl->initialize(_context);
|
_renderControl->initialize(getContext());
|
||||||
setupFbo();
|
setupFbo();
|
||||||
_escrow.setRecycler([this](GLuint texture){
|
_escrow.setRecycler([this](GLuint texture){
|
||||||
_textures.recycleTexture(texture);
|
_textures.recycleTexture(texture);
|
||||||
|
|
Loading…
Reference in a new issue