#### Archived

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

# VA with texture

This topic is 6018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
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.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631781
• Total Posts
3002319
×