PDA

View Full Version : glTexCoordPointer



guju
06-14-2002, 07:32 AM
Hi there!
I want to display a texture, which is calculated based on a vertex value. That means i have one value on each vertex between 0-1.0. Therfore i made the following:
Init:
tripeImage=new float[4*stripeImageWidth];//filled with RGBA values
glGenTextures(1,&texResult);
glBindTexture( GL_TEXTURE_1D, texResult );
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 130, 0, GL_RGBA, GL_UNSIGNED_BYTE,stripeImage);
glEnable(GL_TEXTURE_1D);
In my Draw:
glBindTexture( GL_TEXTURE_1D, texResult );
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(1, GL_FLOAT, 0, result_damage);
But nothing is shown. Whats wrang??
Juergen

V-man
06-14-2002, 08:48 AM
Dimension of a 1D image must be
(power of 2 number ) * 1

That's the first problem.
The second is that you need to enable GL_VERTEX_ARRAY, and also give the glVertexPointer a pointer and use the appropriate command (glDrawArray, glDrawElements, ...)
You aren't using glVertex are you?

V-man

guju
06-14-2002, 09:07 AM
I did not print the following lines:
glEnableClientState (GL_VERTEX_ARRAY);
glVertexPointer (3, GL_FLOAT, 0, vertices);
glDrawElements (GL_QUADS, numQuads*4, GL_UNSIGNED_INT, elements_quad);
Which dimension should be power 2*1?

Bob
06-15-2002, 12:32 AM
The size of your texture must be a power of two. 130 is not a power of two.