1D Texture

Hi There!
I create a 1d texture as follows:
glGenTextures(1,&texResult);
glBindTexture( GL_TEXTURE_1D,texResult);
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, stripeImageWidth, 0, GL_RGBA, GL_FLOAT,stripeImage);// the stripeImage is filled from 0. to 1.
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameteri(GL_TEXTURE_1D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_1D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_1D,GL_TEXTURE_WRAP_S,GL_CLAMP);
In my repaint i make the following:
glEnable(GL_TEXTURE_1D);
glBindTexture( GL_TEXTURE_1D, texResult );
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(1, GL_FLOAT, 0, result_damage);
ShowModelAsList();// Display the DisplayList

But i only get the model with one color, but the entries in result_damage are beween 0. and 0.8.
What could be wrong
Thanks
Juergen

Provided that stripeImageWidth is supplied properly and the image itself is properly organized (i.e. you have all 4 components to your colors and whatnot), I don’t see anything wrong. One thing you may want to try is to convert stripeImage into a GL_UNSIGNED_BYTE like so…

GLuint i;
GLubyte stripeImageUB=(GLubyte)malloc((stripeImageWidth=stripeImageWidth<<2)+1);

stripeImageUB[stripeImageWidth]=’\0’;
for(i=0; i<stripeImageWidth; i=i+1) {
stripeImageUB[i]=(GLubyte)(0.5+stripeImage[i]*255)
}
stripeImageWidth=stripeImageWidth>>2;

glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, stripeImageWidth, 0, GL_RGBA, GL_UNSIGNED_BYTE,stripeImageUB);
free(stripeImageUB);

Try that and see what happens

Dan

the stripe image is ok, because i display a color bar from min. to max.???

So if you create a polygon and render with the 1D texture, it’s looks ok, huh?! Hrmmmm…

OK, you are sure that the object is not trying to use another texture target like TEXTURE_2D or CUBE_MAP or something else without you knowing it?

Try checking your texgen and see if anything is enabled by accident.

Are you using multitexturing at all? Another texture unit could still be unintentionally active.

Dan

My error was, that i used display lists. Now i use immediate mode, and it works!
thanks