PDA

View Full Version : wglMakeCurrent



26hex
02-20-2001, 12:02 PM
okay, a win32 question.

you set the rendering context with
wglMakeCurrent ( hDC, hRC );

but why is it that you clear it with
wglMakeCurrent ( NULL, NULL );

shouldn't you assign a null rendering context
to the DC for the window?

wglMakeCurrent ( hDC, NULL );

every tute/doc i've seen (for win32) does
this. any idea why?

mango
02-20-2001, 06:55 PM
I think it is logical to the make the calling thread's current rendering context no longer current with wglMakeCurrent( NULL, NULL). If hRC is NULL is hDC ignored so you could use it the way you prefer.

26hex
02-20-2001, 07:52 PM
yeah, but can't a calling thread have more
than one window? does win32 actually go
through each and every window of the calling
thread and set its rendering context to null?
just curious, because well
wglMakeCurrent (NULL, NULL) doesn't seriously
look right. it looks like it's just setting
the RC for the NULL window to NULL.
i always use what i said above, but it got
me wondering when my friend pointed it out to
me.

mango
02-21-2001, 07:13 PM
If you want the OpenGL machine to write to a window win with the hardware settings hw_settings:
wglMakeCurrent(win, hw_settings);

If you want to reset the hardware settings would it perhaps be better to have a special function like:
wglResetCurrent();
In the MS OpenGL implementation do you call wglMakeCurrent with a NULL second argument. To me is (NULL, NULL) closer to (void) than (win, NULL) so I prefer the first. http://www.opengl.org/discussion_boards/ubb/smile.gif

It seems like you are thinking of the rendering context as settings for the window but it is more like settings for the hardware.