Note that OpenGL is not reentrant, so be sure to keep all your GL calls to one thread.
That said, I think you''d need to have a "global" store of data/memory in which you create the textures. Realize, though, that you''ll then need to synchronize access using mutexes and all those other lovely multithreading issues.
Other than that, I can offer no specifics. Sorry, hope I helped.
The problem is that I have a thread dedicated to recving network packets, and in that thread I call a function that loads game data. Now it appears glTexImage2D() does not put the texture in a "global" store and is only local to my worker thread.
Im pretty sure there is a way to tell OpenGL to stick the texture in a "global" store, but as you said I would have to open up a whole new can of worms.
So what Im planning to do is just throw a flag in the worker thread that signals the main thread to load the stuff in there.
A rendering context can only be used in one thread at a time. If you want the second thread to create textures for the main thread, you need to move the rendering context over to the second thread before uploading the texture. When done, you must move it back to the main thread. Also make sure you don''t move the thread to the second thread when the main thread is still drawing. All this requires some synchronization.
As you say, best way it so tell the main thread to do it instead.