PDA

View Full Version : Rendering Context in CBuilder5



Inspectah_Deck
06-18-2002, 09:38 PM
Can anyone pls explain, why i must change the rendering context even if i want only to define a texture?

Deiussum
06-19-2002, 05:01 AM
Are you talking about the SetPixelFormat stuff?

I'm not sure why you have to, but you have to have a window initialized to use OpenGL before you use ANY gl* function. I'm not sure exactly why it's like that, but it is. http://www.opengl.org/discussion_boards/ubb/smile.gif

Inspectah_Deck
06-20-2002, 02:26 AM
I have set the OpenGL window already. I have also the rendering context(hrc) and I can load the texture only if I change the context using wglMakeCurrent(Canvas->Handle,hrc). When hrc is not set as the current context, the texture will not load. And this made me a whole lot of troubles, figuring out why the hell is not the texture functioning. Eventually I solved this, but I wonder why is it this way.

Deiussum
06-20-2002, 04:17 AM
Ok, maybe I wasn't clear above. You need to have a window with a GL context (set with wglMakeCurrent) in order to use gl* functions. In order for a window to get a GL context, it needs to be initialized to use GL by using SetPixelFormat.

That's just the way it is. Now that you know, you shouldn't have to spend hours figuring out problems like this next time. http://www.opengl.org/discussion_boards/ubb/smile.gif