Wayland: render to a texture, not a renderbuffer
authorJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 27 Oct 2010 21:44:04 +0000 (14:44 -0700)
committerJørgen Lind <jorgen.lind@nokia.com>
Tue, 25 Jan 2011 17:59:45 +0000 (18:59 +0100)
This will let us source from offscreen GL widget surfaces and copy into
the parent surface.

src/plugins/platforms/wayland/qwaylandintegration.cpp
src/plugins/platforms/wayland/qwaylandwindowsurface.cpp
src/plugins/platforms/wayland/qwaylandwindowsurface.h

index 6842dbf..866a197 100644 (file)
@@ -538,10 +538,10 @@ void QWaylandGLContext::makeCurrent()
     eglMakeCurrent(mDisplay->eglDisplay(), 0, 0, mBuffer->mContext);
 
     glBindFramebuffer(GL_FRAMEBUFFER, mBuffer->mFbo);
-    glBindRenderbuffer(GL_RENDERBUFFER, mBuffer->mRbo);
-    glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, mBuffer->mImage);
-    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-                                GL_RENDERBUFFER, mBuffer->mRbo);
+    glBindTexture(GL_TEXTURE_2D, mBuffer->mTexture);
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mBuffer->mImage);
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+                          GL_TEXTURE_2D, mBuffer->mTexture, 0);
 }
 
 void QWaylandGLContext::doneCurrent()
index 4ae04be..2374eac 100644 (file)
@@ -222,7 +222,6 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display,
     imageAttribs[3] = size.height();
     mImage = eglCreateDRMImageMESA(mDisplay->eglDisplay(), imageAttribs);
     glGenFramebuffers(1, &mFbo);
-    glGenRenderbuffers(1, &mRbo);
     glGenTextures(1, &mTexture);
     glBindTexture(GL_TEXTURE_2D, mTexture);
     glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage);
@@ -237,7 +236,6 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display,
 QWaylandDrmBuffer::~QWaylandDrmBuffer(void)
 {
     glDeleteFramebuffers(1, &mFbo);
-    glDeleteRenderbuffers(1, &mRbo);
     glDeleteTextures(1, &mTexture);
     eglDestroyImageKHR(mDisplay->eglDisplay(), mImage);
     wl_buffer_destroy(mBuffer);
index c8ccdb1..eb9cc40 100644 (file)
@@ -99,7 +99,7 @@ public:
     QWaylandDisplay *mDisplay;
     QGLFramebufferObject *pdev;
     QSize mSize;
-    GLuint mFbo, mRbo;
+    GLuint mFbo;
 };
 
 class QWaylandDrmWindowSurface : public QWindowSurface