I want to render to an off-screen pixmap, which will later be used for a texture. The problem is, as fast as I call glXMakeCurrent, the X-server crashes without any error messages at all. I’ve searched for many examples on off-screen-rendering (which seem to work for their authors), but they all crash!
I’m getting desperate… If anybody knows what’s wrong, please tell my quickly! Also, if any of you know other methods than pixmaps for off-screen rendering, I’m very willing to listen.
Using the backbuffer is the best way for offscreen rendering and if that is not possible is a pbuffer the second best.
If you want to build textures and save them to a file for later use is the natural way to render the usual way and read the pixels from the buffer. This is pretty much the same code as for taking a screenshot.
Well, glCopyTexSubImage2D works great for me, but there’s just one little flaw: I need to render to textures, with sizes like 1024x1024 with the window in any size. Pixmaps would work perfectly well, but those won’t work for me! arr…
Pbuffers are only supported in GLX 1.3, which I do not have (but I do have the 29.60 drivers).
If anybody could point out what’s wrong with my pixmaps OR how to get GLX 1.3, I’d be very thankful.
I had exactly the same problem - it turned out to be a bit-depth issue. The pixmap that the X server was giving me was a 32-bit pixmap, and the visual that glXGetVisual was selecting had a different (smaller, I think) number of bits. So I forced the X server to give me a 24-bit pixmap and let glXGetVisual continue as usual. This fixed the problem.
Oh, and another thing- as I was re-reading this thread, I noticed someone mentioned backbuffers for offscreen rendering. Don’t do this. The back buffer is not really an offscreen context. It can be obliterated by other applications’ windows popping up on top of yours. It can even be obliterated by your own app’s windows, depending on the HW. Those buffer states are technically undefined in the obscured region. Sometimes they work (on some hardware/software) and sometimes they don’t.
Chris
[This message has been edited by chennes (edited 07-18-2002).]
A good point about the danger of using the backbuffer. Another perhaps even bigger problem is if the user can resize the window but if the backbuffer can be used is it the easiest and fastest alternative. A good example is perhaps games running in a top window covering the whole screen.