PDA

View Full Version : Am I missing something important (glXMakeCurrent)



01-06-2004, 07:06 AM
The thing is that I need to make a programm that would display different visuals on two television monitors, using SUSE9 and Nvidia FX 5600 and Nvidia Gforce 4MX 4200
The problem is when I make two window on same display I need to share the glXContext right?
but when I draw to the second screen then the context should be separete? If so then my program destroys the link to first glxContext and uses only the second one.
Because I am a total newbie to the subject I tried sharing the context, then I get no error just the program get terminated (&%%#%##)

SO to the question - am I doing something wrong or is the proble nvidia driver related?

(if I am doing something wrong please let me know)

-Kaspar

JanHH
01-06-2004, 12:41 PM
I do not really understand what you want to do, but an OpenGL window has a rendering context, and if there is another OpenGL window, this would have another OpenGL context. There can be two (or more) separate OpenGL programs running at the same time (if they run in windows, not fullscreen, of course, although this would also work but make no sense on one monitor), and they will not influence each other, and the reason for this that they have individual rendering contexts.

So if you have two OpenGL windows (and a fullscreen display is just the same as a window in this case), you have one rendering context for each, no matter whether they are on the same or on different screens.

Jan

[This message has been edited by JanHH (edited 01-06-2004).]

[This message has been edited by JanHH (edited 01-06-2004).]

01-06-2004, 11:09 PM
hi,
well the thing is, it is one programm (in the first window is color picture RGB) in the second is grayscale(still in RGB)) the ide is to use the first window as layer and second as mask for that layer in realtime television

I have a window object in that object I have functions crate draw etc. and private variables GLSContext, Window, Screen etc.
When I create a window I create a new context with(glXcreateContext(...))
Because every window has its own context the draw functions starts with glXMakeCurrent(Display, Window, GLXContext)
As this code does not generate any errors I assume that it works OK,
when I launch the program the first window is black, and the second window draws allright - so I am wondering maybe GLXcontext is ok but the problem is in Window?

-Kaspar

01-07-2004, 12:39 AM
As I was making two mistakes it was rather hard to pin down!

first: I needed to realese the GLXContext before making next current -> couldnt find any documentation about it (maybe Im just stupid =)), now my draw function starts with:
glXMakeCurrent(perwindowDisplay,None,None);
glXMakeCurrent(perwindowDisplay,perwindowWindow, perwindowCOntext);

second: I used display list (did I mention I am a beginner http://www.opengl.org/discussion_boards/ubb/wink.gif )

-Kaspar

zen
01-07-2004, 02:30 AM
That's strange. I was reading the glx specs a few days ago and don't remember reading anything about realeasing the context before binding a new one. This is done automatically by glXMakeCurrent. It might be a bug in your glx implementation in wich case it's ok but better doublecheck to make sure you're not doing something wrong.

01-07-2004, 11:42 PM
hi,

well I use the glXmakeCurrent in the end of the window::create function to make sure evrything is ok, thats why all my display list's ended up in the same context.

ahnyhow after two days of varius testing this is how far I got it work maybe I should update my GeForce drivers =)

-Kaspar

dorbie
01-21-2004, 12:29 PM
Display lists aren't automatically shared across contexts. You've gotta watch which context is active when you create them unless you explicitly try and share resources.