I am having a difficult time with this function. I am using an indexed vertex array, and an array of texture coordinates.
When I use glDrawElements, the polygons draw all in the proper place, but the textures look like hell.
I checked the arrays, and the values in them are perfect (well, the vertex arrays are for sure since they have no problem drawing in the right places). I thought there must be something wrong with my arrays, but when I unrolled them into a glBegin(GL_QUADS) … glEnd() structure, everything including the textures drew perfectly.
Does anyone have any code showing how this function is supposed to work?
Maybe the api doesn’t like a texture array along with an indexed vertex array?
The render code looks like this:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindTexture(GL_TEXTURE_2D, TextureID);
glVertexPointer(3, GL_FLOAT, 0, pVertexData);
glTexCoordPointer(2, GL_FLOAT, 0, pTriTextureCoordData);
glDrawElements(GL_TRIANGLES, TriCount*3, GL_UNSIGNED_SHORT, pTriBuffer);
Set up code for the texture looks like this:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Like I said, I made a loop that would spew out a glDraw(GL_TRIANGLES) text block with the array data as it was in memory, and all was perfect.
Thanx for any help…
P.S. When I changed the stride in glTexCoordPointer from 0 to another number, there was noticable difference with how the texture looked. I changed it to sizeof(float)*2 thinking it needed to know the distance between each array, but I saw no change in texture.