View Full Version : Rendering to pixmap fails
07-15-2002, 05:51 AM
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.
07-16-2002, 01:36 AM
Thanx for the link, but it didn't work either... crashes right at the glXMakeCurrent http://www.opengl.org/discussion_boards/ubb/frown.gif Nobody ever had this problem?
I've just ordered a new graphic board, hope it'll fix my problems.
07-16-2002, 10:25 AM
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
07-17-2002, 02:51 AM
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! http://www.opengl.org/discussion_boards/ubb/smile.gif
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.
07-18-2002, 06:54 AM
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.
07-18-2002, 06:59 AM
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.
[This message has been edited by chennes (edited 07-18-2002).]
07-18-2002, 11:36 PM
Thanx for your replies! http://www.opengl.org/discussion_boards/ubb/smile.gif 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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.