开发者

Rendering OpenGL FBO Texture to GLXPixmap

I'm writing s开发者_开发百科ome 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 (e.g. 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 =)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜