John Stewart
02-23-2006, 07:20 AM
Hi all;
I have a threaded application that I would like to change so that textures are created in 1 thread, and used in another.
It kind of works, but, although the texture info appears correct for both threads (glGetTexLevelParameteriv calls), the texture appears to not be.
Main thread, which "consumes" textures, has:
XInitThreads();
...
GLcx = glXCreateContext(Xdpy, Xvi, 0, GL_FALSE);
The creator thread does:
textureContext = glXCreateContext(Xdpy, Xvi, GLcx, GL_FALSE);
...
glBindTexture (texnum);
glTexParameteri(...)
glTexImage2D(GL_TEXTURE_2D...)
then signals that the texture is ok.
This method, according to what I can see on-line, should be thread safe.
The textures are kind of written; but both Linux and OS X show the textures incorrect; if they come in as images of say 128x128, RGB, then they are displayed, if not, then the image is "skewed" or some other corruption.
The application is FreeWRL - an X3D/VRML Browser; the major threading code is old; the producer used to read data to a malloc'd bit of code to be glTexImaged (etc) in the consumer thread.
Any thoughts??
I have a threaded application that I would like to change so that textures are created in 1 thread, and used in another.
It kind of works, but, although the texture info appears correct for both threads (glGetTexLevelParameteriv calls), the texture appears to not be.
Main thread, which "consumes" textures, has:
XInitThreads();
...
GLcx = glXCreateContext(Xdpy, Xvi, 0, GL_FALSE);
The creator thread does:
textureContext = glXCreateContext(Xdpy, Xvi, GLcx, GL_FALSE);
...
glBindTexture (texnum);
glTexParameteri(...)
glTexImage2D(GL_TEXTURE_2D...)
then signals that the texture is ok.
This method, according to what I can see on-line, should be thread safe.
The textures are kind of written; but both Linux and OS X show the textures incorrect; if they come in as images of say 128x128, RGB, then they are displayed, if not, then the image is "skewed" or some other corruption.
The application is FreeWRL - an X3D/VRML Browser; the major threading code is old; the producer used to read data to a malloc'd bit of code to be glTexImaged (etc) in the consumer thread.
Any thoughts??