Rendering to pixmap fails

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.

Have you tried the example from Mark Kilgards book? You will find the sources for the book here ftp://ftp.sgi.com/sgi/opengl/OLD/opengl_for_x

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.

Thanx for the link, but it didn’t work either… crashes right at the glXMakeCurrent Nobody ever had this problem?

I’ve just ordered a new graphic board, hope it’ll fix my problems.

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.

No, nvidia supports pbuffers. I posted a little example before http://www.opengl.org/discussion_boards/ubb/Forum4/HTML/000589.html

Well, now the PBuffers are fixed. Somehow, I didn’t have the nvidia include-files… Just a copy and all was well. Thnx for your help!

But those pixmaps still bugs me, even though I don’t need them anymore. If anybody knows what’s wrong, I’ll be happy to learn about it.

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.

Chris

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).]

Thanx for your replies! Now I won’t have nightmares about pixmaps any longer…

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.