diff --git a/examples/simple_demo_qml/GzRenderer.cc b/examples/simple_demo_qml/GzRenderer.cc index 4b4756d02..85bd4aa58 100644 --- a/examples/simple_demo_qml/GzRenderer.cc +++ b/examples/simple_demo_qml/GzRenderer.cc @@ -222,13 +222,20 @@ void GzRenderer::InitialiseOnMainThread() ////////////////////////////////////////////////// void GzRenderer::Render() { - // pre-render may regenerate textureId if the size changes - this->camera->PreRender(); - this->textureId = this->camera->RenderTextureGLId(); - // render to texture this->camera->Update(); + GLuint texIdSrgb = this->camera->RenderTextureGLId(); + + if (this->textureId != texIdSrgb) + { + glBindTexture(GL_TEXTURE_2D, texIdSrgb); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, + GL_SKIP_DECODE_EXT); + } + + this->textureId = texIdSrgb; + // Move camera this->UpdateCamera(); } @@ -276,10 +283,6 @@ void GzRenderer::InitEngine() // quick check on sizing... gzmsg << "imageW: " << this->camera->ImageWidth() << "\n"; gzmsg << "imageH: " << this->camera->ImageHeight() << "\n"; - - // pre-render will force texture creation and may update texture id - this->camera->PreRender(); - this->textureId = this->camera->RenderTextureGLId(); } ////////////////////////////////////////////////// diff --git a/examples/simple_demo_qml/ThreadRenderer.cpp b/examples/simple_demo_qml/ThreadRenderer.cpp index 3e7f01e49..5eb75f97c 100644 --- a/examples/simple_demo_qml/ThreadRenderer.cpp +++ b/examples/simple_demo_qml/ThreadRenderer.cpp @@ -334,10 +334,6 @@ void TextureNode::PrepareNode() // note: include QQuickWindow::TextureHasAlphaChannel if the rendered content // has alpha. - QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions(); - glFuncs->glBindTexture(GL_TEXTURE_2D, newId); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); - #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) # ifndef _WIN32 # pragma GCC diagnostic push diff --git a/examples/simple_demo_qml/ThreadRenderer.h b/examples/simple_demo_qml/ThreadRenderer.h index 6cfa44c02..ed3fc23c6 100644 --- a/examples/simple_demo_qml/ThreadRenderer.h +++ b/examples/simple_demo_qml/ThreadRenderer.h @@ -80,7 +80,6 @@ #include #include #include -#include //-------------------------------------------------------------------------- /*