Archive

Posts Tagged ‘problems’

Multiple OpenGL rendering contexts

July 16, 2008 4 comments

Hi all. Currently I’m working on a software which “should” have different OpenGL areas, each drawn in a different window or a more generic drawable surface (a panel, a group box, etc.. anything that has a window handle in practice).

But what I’m facing is demotivating me 😦

From what I’m reading, if you loose an OpenGL context, you also loose anything associated with it (textures, state changes, etc..):

This means that all the GL state is destroyed with it. This includes textures, among other things. More precisely, on Windows the textures are corrupted, whereas Linux handles it correctly.

Actually, in my application, I have different contexts and simply switch between them thanks to the wglMakeCurrent and everything works fine as long as I just render polygons with glColor.

But as I try to apply a texture (loaded with SDL_Image) nothing happens. So I tried to dump the texture raw data to a file and open it with PhotoShop but the resulting image is completely gray (205/255) 😐

I thought it could be the loosing-context problem mentioned above, so I tried to dump the texture as soon as I upload the data in it with glTexImage2D but I got the same gray image as before. Just to be sure I checked that SDL_Image was loading the texture correctly and that was the case…

I still have to check a couple of things… If you have some tips, please share them with me!

Bye

Advertisements