Sign in to follow this  
lazy_hack

problem in embedding texture on polygon

Recommended Posts

Hi, I have this problem when I try to embed texture on a polygon. The portion of the polygon that's not covered by the texture automatically takes the background color of texture. I want the background polygon to be white.Please help.
[source lang= "c"]
glBindTexture(GL_TEXTURE_2D,image);
// image contains the texture to be embedded
glColor3f(1.0,0.0,0.0);    
	glBegin(GL_POLYGON);
	      glVertex3f(-3.0,-2.0,0.0);
		  glVertex3f(-3.0,2.0,0.0);
		  glVertex3f(3.0,2.0,0.0);
		  glVertex3f(3.0,-2.0,0.0);
         glEnd();
	glBegin(GL_POLYGON);
	         glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, -0.1);
	         glTexCoord2f(0.0, 1.0); glVertex3f(-2.0, 1.0, -0.1);
	         glTexCoord2f(1.0, 1.0); glVertex3f(2.0, 1.0, -0.1);
                 glTexCoord2f(1.0,0.0);  glVertex3f(2.0,-1.0,-0.1);
	  			 			 
	glEnd();

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