Archived

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

Nibbles

one texture over 4 polygons

Recommended Posts

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