PDA

View Full Version : where glTexImage2D loading the image



XaBerr
10-08-2013, 01:04 PM
Hi all, thanks in advance for the answers.
My question is where glTexImage2D loading the image?
because if I make a simple program with a window and with all the code in one file a link to this memory function, instead
if I am using 2 windows made ​​sdl and move the stuff of texture transform it into a class and put it into another file does not work anymore?
It may also depend on the mode multi-thread in Visual Studio?

PS: sorry for my english.

tonyo_au
10-09-2013, 10:57 PM
If you are using 2 windows each with its own OpenGL device context, the image is available in the device context current at the time you load the image. It is also possible to create a shared device context (separate to the window device context) that both windows can use. You make this context current when you load the image; now both windows can use the image.

Osbios
10-12-2013, 01:14 PM
If you use shared context make sure that the opengl objects are ready to be used before the other thread touches them! e.g. after loading an image with glTexImage2D call glFinish or use a fence before signaling the other thread that the texture can be used.