Jump to content
  • Advertisement
Sign in to follow this  
ehmdjii

texture doesnot completely cover all of the polygon

This topic is 4649 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!