My application displays images using textures. It breaks the image into 512x512 blocks and creates a texture with each. The problem I’m having occurs on a multiprocessor (I generate the textures across multiple processors via. pthreads) SPARC running Solaris 8. I’m using Qt as the GUI system that the opengl is embedded in.
It seems that the first texture I generate during a run of the software is corrupted…it contains image data from the second texture I generate. If I use an image that is smaller than 512x512 and thus is a single texture, it looks ok until I create another texture while the first is still being displayed, then I see the same problem.
Some strange things I see. This occurs when running on the console. If I run the application over a network and display on a windows machine with an x server (tried cygwin x and xmanager enterprise) I don’t see the problem. If I run this on windows, I also don’t see the problem. I originally thought it might be a problem with the solaris opengl implementation. The code that generates the textures is:
glGenTextures(1, &handle);
glBindTexture(GL_TEXTURE_2D, handle);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 4, texSizeX, texSizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
I verified that the proper handles are associated with each texture. As a workaround, I had the program generate a texture with random (uninitialized) data then immediately delete that texture to simulate the initial texture generation as the program works fine except for the first image displayed during a run. When I did this, all textures generated were displayed as the first “real” (second) texture generated. This behavior happened on Solaris and Windows. This made me believe there is something wrong with what I’m doing.
Any suggestions?