WinXP texture rendering problem

I’m working on porting an OpenGL app from Linux to Windows XP. It uses
GLUT and NVIDIA texture extensions. In the display update function we
do the following:

glEnable(GL_TEXTURE_SHADER_NV);
glActiveTextureARB(GL_TEXTURE1_ARB);
glTexEnvf(GL_TEXTURE_SHADER_NV,GL_SHADER_OPERATION_NV,GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
glTexEnvf(GL_TEXTURE_SHADER_NV,GL_SHADER_OPERATION_NV,GL_DEPENDENT_GB_TEXTURE_2D_NV);
glTexEnvf(GL_TEXTURE_SHADER_NV,GL_PREVIOUS_TEXTURE_INPUT_NV,GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D,texTable);
glFlush();

glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvf(GL_TEXTURE_SHADER_NV,GL_SHADER_OPERATION_NV,GL_TEXTURE_RECTANGLE_NV);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);

In the function that draws the textures, we do this:

for(i=0;i<h1;i++){
glBindTexture(GL_TEXTURE_RECTANGLE_NV, texTop[i]);
glBegin(GL_QUADS);
vertex[0] = -X; vertex[1] = -Y+sliceInterval*(float)i; vertex[2] = Z;
rotateQuad(vertex);
glTexCoord2f(0.0,0.0); glVertex3f(vertex[0],vertex[1],vertex[2]);
glFlush();
vertex[0] = X;  vertex[1] = -Y+sliceInterval*(float)i; vertex[2] = Z;
rotateQuad(vertex);
glTexCoord2f(0.0,texHeight);
glVertex3f(vertex[0],vertex[1],vertex[2]);
vertex[0] = X;  vertex[1] = -Y+sliceInterval*(float)i;; vertex[2] = -Z;
rotateQuad(vertex);
glTexCoord2f(texWidth,texHeight);
glVertex3f(vertex[0],vertex[1],vertex[2]);
vertex[0] = -X; vertex[1] = -Y+sliceInterval*(float)i; vertex[2] = -Z;
rotateQuad(vertex);
glTexCoord2f(texWidth,0.0);
glVertex3f(vertex[0],vertex[1],vertex[2]);
glEnd();
glFlush();

}

So, every time GLUT is asked to redraw, the NVIDIA stuff is set and the
textures are drawn. For some reason, this only works the first time.
Successive texture draws don’t seem to write anything (or much) to the
buffer, even if all the parameters are the same. The screen becomes
blank, with a few traces of what should be there. This works find under
Linux, but not on Windows XP. Any idea what gives?

Hi Kyle, it’s quite ‘dangerous’ to use GlFlush() like that, a friend tell me that look like barbarian :smiley:

Anyway you should desactivate floating buffers and nVidia extensions to check if it’s ok (custom debugging ^^)

I’m waiting your feedback

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.