PDA

View Full Version : Multi threaded object loading



ED_RockStarGuy
06-27-2016, 02:59 AM
I am wanting to move my object loading over to another thread but its my understanding that OpenGL is locked to the thread it was created on, so I was wanting to know the best practise to multithread object loading.

The only solution I have came up with is having the OBJ loading/Texture file loading on one thread, then process it into its vertices, texture quads and normals, then pass it back to the main thread to be saved to the GPU.

Is there any other way of doing this that utilizes multithreading better?

Cornix
06-27-2016, 03:17 AM
Loading has nothing to do with OpenGL. Only uploading to the driver must be done on the main thread (or a thread with a shared context). You can load as much as you like on a separate thread, pass the data into a queue and have it uploaded by the main thread, or alternatively share the context and upload it from the same thread.

ED_RockStarGuy
06-27-2016, 03:36 AM
Loading has nothing to do with OpenGL. Only uploading to the driver must be done on the main thread (or a thread with a shared context). You can load as much as you like on a separate thread, pass the data into a queue and have it uploaded by the main thread, or alternatively share the context and upload it from the same thread.

Thank you for the clarification, it is much appretiated.