If I have more than one rendering context, and I want to use the same texture
in each of them, do I have to create this texture again in each RC? Essentially
having 4 copies of the same texture?
Or can I create the texture once with glGenTextures and share its texture_id
among all these rendering contexts?
You should be able to use wglShareLists for Windows or its equivalent on other platforms. glXCreateContext for XWindows platforms.
Texture names and their contents are local to the shared display list space of the current GL rendering context. Two rendering contexts share texture names only if they also share display lists. (This is mentioned in the OpenGL Reference Manual (blue book) under glBindTexture)
Great, thanks. I didn’t know about wglShareLists.
From the Win32 docs for wglShareLists:
“You can only share display lists with rendering contexts within the same process.”
Can wglShareLists be used to share texture IDs in two or more threads?
Not sure if “process” is equivalent to “thread”.
The answer is yes, you can share textures between threads too.