Sign in to follow this  

texture doesnot completely cover all of the polygon

This topic is 4342 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, if i add a texture on a polygon, it happens, that the textures dont fill the polygon to the very end. it seems as if the last pixel still is untextured, this is really annyoing for example in a skybox, where you can detect seams along the polygons. here is the code i have:
	glEnable(GL_TEXTURE_2D);
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);	
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
	
	glBindTexture(GL_TEXTURE_2D, backtex->getTexID());
	glBegin(GL_QUADS);		
		glTexCoord2i(1, 0); glVertex3f(SSIZE, 0,     0);
		glTexCoord2i(1, 1); glVertex3f(SSIZE, SSIZE, 0); 
		glTexCoord2i(0, 1); glVertex3f(0,     SSIZE, 0);
		glTexCoord2i(0, 0); glVertex3f(0,     0,     0);
	glEnd();

	glBindTexture(GL_TEXTURE_2D, fronttex->getTexID());
	glBegin(GL_QUADS);	
		glTexCoord2i(1, 0); glVertex3f(0,     0,     SSIZE);
		glTexCoord2i(1, 1); glVertex3f(0,     SSIZE, SSIZE);
		glTexCoord2i(0, 1); glVertex3f(SSIZE, SSIZE, SSIZE); 
		glTexCoord2i(0, 0); glVertex3f(SSIZE, 0,     SSIZE);
	glEnd();

//other skybox sides....

i would be very thankful about solutions to my problem

Share this post


Link to post
Share on other sites
GL_CLAMP wrapping mode clamps texture coordinates to [0, 1] which means the edges of the clamp range steps halfway into the texture border, which is probably not what you want. The correct slamping mode to clamp the texture coordinates to the texture data only would be GL_CLAMP_TO_EDGE.

Share this post


Link to post
Share on other sites

This topic is 4342 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.

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