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

Implement OpenGL ES 2 path for Qt 5.15

parent 5eef0d36
......@@ -33,6 +33,9 @@ QVncItem::QVncItem()
QVncItem::~QVncItem()
{
delete m_vncServer;
if (m_fboId != 0)
glDeleteFramebuffers(1, &m_fboId);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
......@@ -363,14 +366,25 @@ void QVncItem::grabTexture()
int textureId = texture->textureId();
if (textureId > 0) {
QSize s = texture->textureSize();
newImg = QImage(s, QImage::Format_ARGB32);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureId);
#ifdef GL_ES_VERSION_2_0
qWarning() << "OpenGL ES not supported without RHI";
newImg = QImage(s, QImage::Format_RGBA8888);
if (m_fboId == 0)
glGenFramebuffers(1, &m_fboId);
glBindFramebuffer(GL_FRAMEBUFFER, m_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);
#else
newImg = QImage(s, QImage::Format_ARGB32);
glGetTexImage(GL_TEXTURE_2D,
0,
GL_BGRA,
......
......@@ -100,6 +100,7 @@ private:
QElapsedTimer m_frameTimer;
int m_frameCount = 0;
int m_grabCount = 0;
quint32 m_fboId = 0;
QByteArray m_password;
};
......
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