Archived

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

VA with texture

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites