Archived

This topic is now archived and is closed to further replies.

Leyder Dylan

VA with texture

Recommended Posts

Leyder Dylan    122
Hi, I want to use VA in my 3D engine and I''ve a question. I want to specify a texture for each polygon, how can I do that ? Ex : Here''s 2 polygons : // Vertex Vertex3 Vertex[] = { { -2.0f, 2.0f, -2.0f, }, // Face gauche { -2.0f, -2.0f, -2.0f, }, { -2.0f, -2.0f, 2.0f, }, { -2.0f, 2.0f, 2.0f, }, { 2.0, 2.0f, 2.0f, }, // Face droite { 2.0, -2.0f, 2.0f, }, { 2.0, -2.0f, -2.0f, }, { 2.0, 2.0f, -2.0f, } }; // Texture coord. Vertex2 Text_Coord[] = { { 0.0f, 1.0f, }, { 0.0f, 0.0f, }, { 1.0f, 0.0f, }, { 1.0f, 1.0f, }, { 0.0f, 1.0f, }, { 0.0f, 0.0f, }, { 1.0f, 0.0f, }, { 1.0f, 1.0f, }, }; Here''s the function for displaying the 2 polygons : ... etc glDrawArrays(GL_QUADS, 0, 8); ... etc I''d like that each polygon has a different texture. How ? ======================== Leyder Dylan http://ibelgique.ifrance.com/Slug-Production/

Share this post


Link to post
Share on other sites
python_regious    929
Firstly, it would be better to use glDrawElements for this. This way, you simple call the glVertexPointer/TexPointer etc calls, then pass each of the indices of the sides of the cube to glDrawElements, binding to a different texture each time.

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites