PDA

View Full Version : glXMakeContextCurrent



02-28-2004, 01:23 PM
Hi there... I'm trying to use this GLX function as part of some wrangling to get a pbuffer under OpenGL+Linux up and running... Admittedly, I don't know anything about GLX, so in a sense I'm a bit ignorant... Please forgive.

The question: Things (i.e., from glXGetCurrentDisplay to glXMakeContextCurrent) actually works. What I don't understand is when this context "goes out of scope" and the old one is restored...?! My "test drawing" and subsequent glReadPixels and writing to file indicates that the thing gets written to the pbuffer properly (*), but after those codelines, the rest of my original program seems to just revert to drawing to the visible framebuffer... I would have expected everything from that point on to end up in the pbuffer!!! Is my "pbuffer context" discarded as soon as I do a glEnable, Disable, End, Begin, or something?!

I guess the main problem here is that I don't actually know where to look... Googling didn't help, for once... :-(

(*) Funny thing is that a glClear on the pbuffer misses the last row and last column of pixels! Oh, well... thats nit-picking...

idr
02-28-2004, 06:46 PM
What card / drivers are you using? The pbuffer should remain bound until you either bind a different drawable to the current context or bind a different context. A little more information (perhaps a code snippet) would help.

02-29-2004, 01:28 AM
Nvidia driver 2880, GeForce 3 gpu. After some bickering about, I have more or less concluded that between exit of the registered glutDisplayFunc callback function, and the entry of the same function for a new frame, glut (or something else) causes my "pbuffer-context made current" to have been "de-current-ified"... Maybe this actually makes sense, I'm not sure. However, I don't need my pbuffer to survive for more than a frame, so it will not be much of a problem. (And I guess I could always start the callback function by switching in the context if I needed that.)

So far, the conclusion seems more to be that I'm slightly annoyed at not completely understanding what's going on in the background, rather than stuff not working. So it's maybe not so bad, really...

idr
03-02-2004, 02:14 PM
It sounds like GLUT is doing something behind your back. You might look through the GLUT code and try setting some breakpoints (perhaps one in glXMakeCurrent) to see what's going on.

03-03-2004, 06:36 AM
I think you're right idr. I don't think I'll look more into it for now, because my stuff (which is only of prototype quality) works as it should.

And the missing row+column of pixels cleared only happened on one computer (Nvidia's 2880 driver + GF 3 ti200) and not on e.g. an fx5900 box...