Archived

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

Waldoo

Multi-Texture mapping question

Recommended Posts

How do you put several separated texture mappings on a single square? Waldoo Edited by - waldoo on January 29, 2002 2:00:52 AM

Share this post


Link to post
Share on other sites
  
glActiveTexture(GL_TEXTURE0); // activate first textuer unit

glBindTexture(GL_TEXTURE_2D, tex0); // bind texture to first unit

glActiveTexture(GL_TEXTURE1); // activate second texture unit

glBindTexture(GL_TEXTURE_2D, tex1); // bind texture to second unit


Then you need to specify texture coordinates for both units.
  
glBegin(GL_QUADS);
glMultiTexCoord2f(GL_TEXTURE0, 0, 0); // coordinates for first texture

glMultiTexCoord2f(GL_TEXTURE1, 0, 0); // coordinates for second texture

glVertex2f(...); // first vertex

... // and so on, for each vertex

glEnd();

Share this post


Link to post
Share on other sites
sorry to ruin your dream.. but there IS init code.. and quite ugly one.. Look at tutorial 22... it''s all there...

There are more worlds than the one that you hold in your hand...

Share this post


Link to post
Share on other sites
I didnt mean that. What I mean is several separated pictures on a square. A picture of anything on each corner (4 pictures).

Waldoo

Share this post


Link to post
Share on other sites
That looks pretty easy, can you assign colors for the seperate textures?

When he''s best, he''s little worst than a man,
When he''s worst, he''s little better than a beast.

Share this post


Link to post
Share on other sites