Jump to content
  • Advertisement

Archived

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

Nibbles

one texture over 4 polygons

This topic is 6222 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 was wondering how to have one texture spread out across, say 4 polygons. Thank ya! Scott Email Website
"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Try :

glBindTexture(GL_TEXTURE_2D, Texture[0]);
Polygone1();
glBindTexture(GL_TEXTURE_2D, Texture[0]);
Polygone2();
glBindTexture(GL_TEXTURE_2D, Texture[0]);
Polygone3();
glBindTexture(GL_TEXTURE_2D, Texture[0]);
Polygone3();



========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/

Share this post


Link to post
Share on other sites
sorry, i should have used image or bmp instead of texture. it''s not a wrapped around texture or anything, it''s actually the logo for a project of mine, but i want to display it on more than one polygon.

Scott

Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
Well I''m not positive about what you are asking here but here is how you would take any texture and stretch it across 4 polygons of equal size:

glBegin( GL_QUADS );
//bottom left quad
glTexCoord2f( 0.0f, 0.0f ); glVertex3f( -4.0f, 0.0f, 0.0f );
glTexCoord2f( 0.0f, 0.5f ); glVertex3f( -4.0f, 2.0f, 0.0f );
glTexCoord2f( 0.5f, 0.5f ); glVertex3f( -2.0f, 2.0f, 0.0f );
glTexCoord2f( 0.5f, 0.0f ); glVertex3f( -2.0f, 0.0f, 0.0f );

//top left quad
glTexCoord2f( 0.0f, 0.5f ); glVertex3f( -4.0f, 2.0f, 0.0f );
glTexCoord2f( 0.0f, 1.0f ); glVertex3f( -4.0f, 4.0f, 0.0f );
glTexCoord2f( 0.5f, 1.0f ); glVertex3f( -2.0f, 4.0f, 0.0f );
glTexCoord2f( 0.5f, 0.5f ); glVertex3f( -2.0f, 2.0f, 0.0f );

//top right quad
glTexCoord2f( 0.5f, 0.5f ); glVertex3f( -2.0f, 2.0f, 0.0f );
glTexCoord2f( 0.5f, 1.0f ); glVertex3f( -2.0f, 4.0f, 0.0f );
glTexCoord2f( 1.0f, 1.0f ); glVertex3f( 0.0f, 4.0f, 0.0f );
glTexCoord2f( 1.0f, 0.5f ); glVertex3f( 0.0f, 2.0f, 0.0f );

//bottom right quad
glTexCoord2f( 0.5f, 0.0f ); glVertex3f( -2.0f, 0.0f, 0.0f );
glTexCoord2f( 0.5f, 0.5f ); glVertex3f( -2.0f, 2.0f, 0.0f );
glTexCoord2f( 1.0f, 0.5f ); glVertex3f( 0.0f, 2.0f, 0.0f );
glTexCoord2f( 1.0f, 0.0f ); glVertex3f( 0.0f, 0.0f, 0.0f );
glEnd();

I think that is right anyways. lol

Seeya
Krippy

Share this post


Link to post
Share on other sites
Ehm, Dylan. You don''t have to bind the same texture multiple times. The next poly will use the texture binded last.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!