Vertex Arrays and Texturing

  • Follow


For a little background, I am attempting to render 16*16 QUADS in a 16
x 16 grid.  I use 3 floats to specify a vertex, and 2 floats to
specify the texture coord for that vertex.

The QUADs are drawn properly, however I am experiencing some odd
behavior with the texturing of these 256 quads, namely, only every 4th
quad is textured.  It seems that the first set of texture coordinates
are assigned to the first quad, while the second set of texture
coordinates are being assigned to the fourth quad (two quads are
skipped) and so on.  Below is the code that I am using to call the
vertex arrays:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(3, GL_FLOAT, 0, topTileVertex);
glTexCoordPointer(2, GL_FLOAT, 0, topTileTex);
glDrawArrays(GL_QUADS, 0, MAP_SIZE*4);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

I don't believe that the coordinates in the actual arrays are
incorrect, as these are the same coords I used when drawing in
immediate mode.  Any insight would be greatly appreciated.

Thanks,
Alex
0
Reply abwood 8/12/2004 2:44:18 PM

i think u array of tex_coord is too small

maybe i am wrong

"Alex" <abwood@ncsu.edu> a �crit dans le message de
news:a77d4dd1.0408120644.4fab8c90@posting.google.com...
> For a little background, I am attempting to render 16*16 QUADS in a 16
> x 16 grid.  I use 3 floats to specify a vertex, and 2 floats to
> specify the texture coord for that vertex.
>
> The QUADs are drawn properly, however I am experiencing some odd
> behavior with the texturing of these 256 quads, namely, only every 4th
> quad is textured.  It seems that the first set of texture coordinates
> are assigned to the first quad, while the second set of texture
> coordinates are being assigned to the fourth quad (two quads are
> skipped) and so on.  Below is the code that I am using to call the
> vertex arrays:
>
> glEnableClientState(GL_VERTEX_ARRAY);
> glEnableClientState(GL_TEXTURE_COORD_ARRAY);
>
> glVertexPointer(3, GL_FLOAT, 0, topTileVertex);
> glTexCoordPointer(2, GL_FLOAT, 0, topTileTex);
> glDrawArrays(GL_QUADS, 0, MAP_SIZE*4);
>
> glDisableClientState(GL_VERTEX_ARRAY);
> glDisableClientState(GL_TEXTURE_COORD_ARRAY);
>
> I don't believe that the coordinates in the actual arrays are
> incorrect, as these are the same coords I used when drawing in
> immediate mode.  Any insight would be greatly appreciated.
>
> Thanks,
> Alex


0
Reply Lechevalier 8/13/2004 11:36:35 PM


> 
> I don't believe that the coordinates in the actual arrays are
> incorrect, as these are the same coords I used when drawing in
> immediate mode.  Any insight would be greatly appreciated.
> 

Alex, you are wrong here.  The arrays weren't being built properly.

> Thanks,
> Alex


Your welcome,
Alex
0
Reply abwood 8/14/2004 2:22:12 AM

2 Replies
233 Views

(page loaded in 0.055 seconds)

Similiar Articles:













7/24/2012 12:55:09 PM


Reply: