Answer the question
In order to leave comments, you need to log in
Loading data into an atlas texture on a background thread (OpenGL ES 2.0)
There are 2 contexts. One is used for rendering in the main thread, the second for loading textures in the background. If you do not use atlases, then there will be no difficulties, because the texture is not accessed at the moment 100% is written to it. And if I need to update a section of the atlas, but at the same time draw from the same atlas, but other sections - will I perform the act of stepping on a rake, or will everything go smoothly?
Answer the question
In order to leave comments, you need to log in
Depending on which platform (iOS \ Android and GPU model), in principle, in devices with iOS, video memory and RAM are combined into one chip, therefore, with map \ unmap, we get a pointer on which you can safely write. You can try to just do it head-on: two contexts, the atlas is shared between them, the first one draws, the second one updates its data. It can be a little more complicated: using GL_APPLE_sync to create synchronization points when the atlas is drawn, and fill in the data only when it is not used. Or even a clumsy decision: make two copies of the atlas, draw the first one, fill it with the second one, then swap them.
ps. You can read the texture that you read from the flash drive through the memory mapping file, this usually gives an increase in IO and you do not need to allocate a temporary buffer, only the textures on the flash drive should be in RAW format. I wrote more on another resource .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question