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: Vertex Arrays and Texturing - comp.graphics.api.openglFor 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 ... glDrawElements with different texture indices - comp.graphics.api ...> is it possible to have a different indices array for the tex > coords array ? No, becuase it makes no sense. Maybe you think, that a vertex shares n texture coordinates ... Vertex Array Implementation - comp.graphics.api.openglVertex Arrays and Texturing - comp.graphics.api.opengl Vertex Array Implementation - comp.graphics.api.opengl Could someone please explain the best way to use vertex arrays. glDrawArrays vs glDrawElements - comp.graphics.api.opengl ...glDrawElements with different texture indices - comp.graphics.api ... Vertex Arrays and Texturing - comp.graphics.api.opengl If every index in the indices array is shared ... Strange Length of an array ?? - comp.lang.xharbourVertex Arrays and Texturing - comp.graphics.api.opengl Strange Length of an array ?? - comp.lang.xharbour Vertex Arrays and Texturing - comp.graphics.api.opengl The QUADs ... OpenGl wrapper for CSharp - comp.graphics.api.openglVertex arrays and unexpected behaviour 56 98 Makhno ... How to save a texture to a file 1 204 Nightfalll VBOs vs Display Lists - lets test it out! - comp.graphics.api ...> In the best case, they could be split between VBOs and vertex array > ranges ... glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY ... Raw 3D texture - comp.graphics.api.openglwrite texture to file - comp.graphics.api.opengl C++ library/DLL to read/write 3D file formats ? - comp.graphics ... MS Win device ... Writing raw texture data to file Im ... Drawing a circle. - comp.graphics.api.openglI mean just a circle drawn by a continuous line, there are no filling nor texture ... for use with OpenGL, I guess you could write the points it produces to a vertex array ... Shading problem - comp.graphics.api.openglA "vertex" has a position, a normal, some texture coordinates, etc ... that NVIDIA (but not ATI) is good with byte > normals to save memory in a vertex array ... Vertex Arrays and Texturing - comp.graphics.api.opengl | Computer ...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 ... NeHe Productions: Vertex Buffer Objects// Disable Pointers glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord ... 7/24/2012 12:55:09 PM
|