Rendering Context in CBuilder5

Can anyone pls explain, why i must change the rendering context even if i want only to define a texture?

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.

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.

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.