Rendering OpenGL FBO Texture to GLXPixmap

I'm writing some code which is intended to: 1. Render into an OpenGL texture using an FBO. 2. Draw from the FBO texture to a GLXPixmap, which is attached to an X Pixmap. 3. Draw the X Pixmap to a window on the screen.

Step 3 works great, and step 2 works fine if I replace the FBO texture with normal OpenGL drawing.

But if I do what's above, at least with the code I have, it doesn't work. If I give the GLXPixmap a colored background, and do 1-3, the window on the screen turns white, but nothing else I've drawn appears.

So I'm hoping someone can provide tips, or point me to some simple sample code. The code I've got for this is fairly convoluted, but if needed, I can try to write a simple sample version to post here for review.


If your last two steps work, but not using the FBO you create in step one, you're probably initializing the FBO incorrectly. Some things to check:

  • is the FBO "framebuffer complete"? Check using glCheckFramebufferStatus( GL_FRAMEBUFFER_COMPLETE ) after you attach all your textures and/or renderbuffers to it.
  • Do you have any way of examining the FBO after you render to it (eg using glGetTexImage ) to determine whether the problem is with writing to the FBO or reading from it?
  • You've probably already checked, but it's worth asking: does glGetError() return any errors?
  • If everything checks out correctly, then post some skeleton setup and rendering code... although the less convoluted the better, of course =)

    链接地址: http://www.djcxy.com/p/5808.html

    上一篇: 在Android和OpenGL ES中将字符串渲染到纹理

    下一篇: 将OpenGL FBO纹理渲染为GLXPixmap