Sign in to follow this  
indieboy

tile-based texture on polygon

Recommended Posts

How can i apply some tile-based texture on a polygon? Is there any way to easly do that ? Do i have to calculate all points? if so, i just learned how to map 4 points (0,0; 0,1; 1,1; 0,0) Anyway, this is the the code for my polygon:
int topLeft=glGenLists(1);    
    glNewList(topLeft,GL_COMPILE);
    glBegin(GL_POLYGON);
    for(float i = PI/6; i < (PI )* 1; i+= PI/6)
    {
        glVertex3f( cos(i) * topSize, baseHeight,  sin(i)* topSize);
    }
    glVertex3f( -(topSize/5) * topSize, baseHeight, sin(PI -(PI/6))* topSize);
    glVertex3f( (topSize/5) * topSize, baseHeight, sin(PI -(PI/6))* topSize);
    glEnd();
    glEndList();

Share this post


Link to post
Share on other sites
If you want to tile a texture on a polygon lets say 4 times you put instead of 1.0, 4.0..But if you're using skins than you must know the offset of every skin you have and use that coordinates.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this