I’m trying to make a simple map viewing program in OpenGL. The map is made up of heaps of faces that have textures that only load when they need to be viewed. The problem is that when a texture is loaded it locks up my program for a bit. What I want to do is use another thread to load the textures.
I tried this using the win32 CreateThread() function. When the texture needs to load now, a thread is spawned and the program runs slightly slower as the texture is loaded (good sign). My problem is the texture never loads sucessfully. I believe this is because opengl doesnt know that my new thread is associated with the original opengl context. I tried using
wglMakeCurrent() in the new thread but that didnt work. Has anyone done
anything like this before?