mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-16 18:18:19 +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();
|
||||
}
|
||||
|
||||
void OffscreenGLCanvas::create(QOpenGLContext* sharedContext) {
|
||||
bool OffscreenGLCanvas::create(QOpenGLContext* sharedContext) {
|
||||
if (nullptr != sharedContext) {
|
||||
sharedContext->doneCurrent();
|
||||
_context->setShareContext(sharedContext);
|
||||
}
|
||||
_context->setFormat(getDefaultOpenGLSurfaceFormat());
|
||||
_context->create();
|
||||
if (_context->create()) {
|
||||
_offscreenSurface->setFormat(_context->format());
|
||||
_offscreenSurface->create();
|
||||
return true;
|
||||
}
|
||||
|
||||
_offscreenSurface->setFormat(_context->format());
|
||||
_offscreenSurface->create();
|
||||
qWarning() << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
||||
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() {
|
||||
|
|
|
@ -23,7 +23,7 @@ class OffscreenGLCanvas : public QObject {
|
|||
public:
|
||||
OffscreenGLCanvas();
|
||||
~OffscreenGLCanvas();
|
||||
void create(QOpenGLContext* sharedContext = nullptr);
|
||||
bool create(QOpenGLContext* sharedContext = nullptr);
|
||||
bool makeCurrent();
|
||||
void doneCurrent();
|
||||
QOpenGLContext* getContext() {
|
||||
|
|
|
@ -65,7 +65,11 @@ class OffscreenQmlRenderer : public OffscreenGLCanvas {
|
|||
public:
|
||||
|
||||
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();
|
||||
|
||||
|
@ -153,7 +157,7 @@ private:
|
|||
qWarning("Failed to make context current on render thread");
|
||||
return;
|
||||
}
|
||||
_renderControl->initialize(_context);
|
||||
_renderControl->initialize(getContext());
|
||||
setupFbo();
|
||||
_escrow.setRecycler([this](GLuint texture){
|
||||
_textures.recycleTexture(texture);
|
||||
|
|
Loading…
Reference in a new issue