Hello,
there's a strange problem with glTexSubImage2D in my app: it seems like it doesn't properly update my texture.
I have an array GLubyte pixels[width][height][3] which contains my pixels data. Each frame I change it and update my texture this way:
glBindTexture( GL_TEXTURE_2D, tex_handle );
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, pixels );
Then a bunch of quads are rendered and textured with my texture.
The problems is as follows:
When the whole thing appears on the screen, some of my quads still contain the originally texture as it was when I firstly created my texture. If I replace glTexSubImage2D with gluBuild2DMipMaps everything shows up fine. Unfortunately its a bit slow then.
The texture is initially created this way:
CreatePixelData(); // create initial pixel data
glGenTextures( 1, &tex_handle );
glBindTexture( GL_TEXTURE_2D, tex_handle );
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
For testing I make my texture yellow and then let it fade out slowly. The result is that many quads remain the originally color while others fade out. The ones that are displayed yellow change each frame. (Thus one frame quad 1 is yellow, the next frame it's dark again, some frames later being yellow again...)
Can anyone help me ?
Edited by - cmdkeen on January 29, 2002 2:25:42 PM