views:

314

answers:

1

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.

+1  A: 

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 =)

Asher Dunn
Alas, I checked the fbo status, and it is complete. And I'm checking glGetError using a macro that reports if there's a problem, and no complaints. But I'll check glGetTexImage() out, and also try to put together a simple sample - that in itself may lead me to a solution. :-)
Bob Murphy
Another simple thing (not trying to insult you -- I've made this mistake several times!) is to make sure you're using GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE consistently
Asher Dunn