Commit f22dfa82 authored by Eskil Abrahamsen-Blomfeldt's avatar Eskil Abrahamsen-Blomfeldt
Browse files

Fix compilation with desktop GL

glDeleteFramebuffers() cannot be called directly for desktop GL
where we link to the GL library dynamically. It is also only
used from the ES2 code. Instead of adding additional #ifdef for
it, we just move it to grabTexture(), since deleting it from the
destructor, which is called from a different thread, is not valid
anyway.

It means we will create and destroy the ID every frame we capture,
but since it is just registering an ID, this should be fine.
parent 174b5be6
......@@ -33,9 +33,6 @@ QVncItem::QVncItem()
QVncItem::~QVncItem()
{
delete m_vncServer;
if (m_fboId != 0)
glDeleteFramebuffers(1, &m_fboId);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
......@@ -373,15 +370,16 @@ void QVncItem::grabTexture()
#ifdef GL_ES_VERSION_2_0
newImg = QImage(s, QImage::Format_RGBA8888);
if (m_fboId == 0)
glGenFramebuffers(1, &m_fboId);
GLuint fboId;
glGenFramebuffers(1, &fboId);
glBindFramebuffer(GL_FRAMEBUFFER, m_fboId);
glBindFramebuffer(GL_FRAMEBUFFER, fboId);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0);
glReadPixels(0, 0, s.width(), s.height(), GL_RGBA, GL_UNSIGNED_BYTE, newImg.bits());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &fboId);
#else
newImg = QImage(s, QImage::Format_ARGB32);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment