Is it possible to load data into a texture in a thread? Or is there any faster ways to load pixels into a texture?
I’m quite new to OpenGL and pretty sure this would not be of much help, but there seems to many discussions about the topic of using multi-threading with OpenGL to make a program faster.
The link I found below talks of having two threads, one that does the rendering and the other for loading shared data.
This example might be what you’re looking for.
The threaded image loader works without a texture, it is pixels only. I have my pixels coming in a thread, but it is the uploading to the GPU that I want to try and optimise.
It does, but updates the textures of queued tasks one-by-one in subsequent
update() calls so you have to wait for the thread to finish.
There’s also ofxAsyncTextureLoader which uses a second OpenGL context to upload the data to the GPU, off-loading the main thread. Both work but their convenience lies more in the fact that they’re asynchronous rather than offer faster overall loading times.