From b6bf50fd81c77498aecc024ac52a82c8322dfd3b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 15 Jun 2017 16:10:20 +0200 Subject: Set size and format in SharedMemoryBuffer::toOpenGlTexture The texture returned previously would have size (1,1) and format NoFormat Change-Id: Ic627b7ff9d10cc87cd9307f5f18ea96458fae212 Reviewed-by: Giulio Camuffo --- src/compositor/wayland_wrapper/qwlclientbuffer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp index 01a4f3d73..7d7e787c4 100644 --- a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp +++ b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp @@ -170,11 +170,14 @@ QOpenGLTexture *SharedMemoryBuffer::toOpenGlTexture(int plane) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // TODO: partial texture upload QImage image = this->image(); + m_shmTexture->setSize(image.width(), image.height()); if (image.hasAlphaChannel()) { + m_shmTexture->setFormat(QOpenGLTexture::RGBAFormat); if (image.format() != QImage::Format_RGBA8888) image = image.convertToFormat(QImage::Format_RGBA8888); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constBits()); } else { + m_shmTexture->setFormat(QOpenGLTexture::RGBFormat); if (image.format() != QImage::Format_RGBX8888) image = image.convertToFormat(QImage::Format_RGBX8888); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, image.constBits()); -- cgit v1.2.3