Jump to content
  • Advertisement
Sign in to follow this  
CRACK123

Lines at joining of textures in skybox

This topic is 5009 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, I implemented a skybox but I seem to get lines on the edges where the 2 textures meet. It happens occasionally but its visible. I have a screenshot to show exactly what I mean here http://gautam.digitalthinker.org/Screenshots/skyboxshot.png This is how I am rendering the skybox
	float matrix[16];
	
	glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
	matrix[12] = 0;
	matrix[13] = 0;
	matrix[14] = 0;

	glPushMatrix();
	glLoadMatrixf(matrix);
	glBindTexture(GL_TEXTURE_2D, texture[FRONT]);
	
	glBegin(GL_QUADS);
		glTexCoord2f(0, 0); glVertex3f(-100,   100, -100);
		glTexCoord2f(0, 1); glVertex3f(-100,  -100, -100);
		glTexCoord2f(1, 1); glVertex3f( 100,  -100, -100);
		glTexCoord2f(1, 0); glVertex3f( 100,   100, -100);
	glEnd();
		
	glBindTexture(GL_TEXTURE_2D, texture

); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(100, 100, -100); glTexCoord2f(0, 1); glVertex3f(100, -100, -100); glTexCoord2f(1, 1); glVertex3f(100, -100, 100); glTexCoord2f(1, 0); glVertex3f(100, 100, 100); glEnd(); glBindTexture(GL_TEXTURE_2D, texture

); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-100, 100, 100); glTexCoord2f(0, 1); glVertex3f(-100, -100, 100); glTexCoord2f(1, 1); glVertex3f(-100, -100, -100); glTexCoord2f(1, 0); glVertex3f(-100, 100, -100); glEnd(); glBindTexture(GL_TEXTURE_2D, texture[BACK]); glBegin(GL_QUADS); glTexCoord2f(1, 0); glVertex3f(-100, 100, 100); glTexCoord2f(0, 0); glVertex3f( 100, 100, 100); glTexCoord2f(0, 1); glVertex3f( 100, -100, 100); glTexCoord2f(1, 1); glVertex3f(-100, -100, 100); glEnd(); glBindTexture(GL_TEXTURE_2D, texture[UP]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-100, 100, 100); glTexCoord2f(0, 1); glVertex3f(-100, 100, -100); glTexCoord2f(1, 1); glVertex3f( 100, 100, -100); glTexCoord2f(1, 0); glVertex3f( 100, 100, 100); glEnd(); glBindTexture(GL_TEXTURE_2D, texture[DOWN]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-100, -100, -100); glTexCoord2f(0, 1); glVertex3f(-100, -100, 100); glTexCoord2f(1, 1); glVertex3f( 100, -100, 100); glTexCoord2f(1, 0); glVertex3f( 100, -100, -100); glEnd(); glPopMatrix();

Any idea as to how to remove the seam/lines ? Thanks

Share this post


Link to post
Share on other sites
Advertisement
I tried using GL_CLAMP_TO_EDGE but it had no effect. I am using ilutGLLoadImage from DevIL - I am not sure if that might have anything to do with it. It shouldn't though in my opinion.

However I will try with removing the ilut part and use the il and ilu functions and do the rest in opengl code and post back.

Share this post


Link to post
Share on other sites
I think it doesnt matter what you use for loading the images.
Just do:


glBindTexture(GL_TEXTURE_2D,MyTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);


Or if that doesnt work... well, then I suppose your video card doesnt support it, although thats possible only on some VERY old cards (I remember my Voodoo3 didnt support it, hehe :) ) Maybe it could be a driver issue if your video card is up to date, dunno, but that should work.

Share this post


Link to post
Share on other sites
Hi,

I thought this had to be done only once -
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

I did it after every call to
glBindTexture(...)

and now it works - thanks.


Share this post


Link to post
Share on other sites
Actually you dont have to do it after every glBindTexture(); The way I understand this works is that every texture has variables to store the GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T and some other parametres. And You can change them using glTexParameteri when the texture is bound using glBindTexture and the variables keep that in memory. So if you set that for each texture during loading time you dont have to do that when rendering. Unless of course you want to use the same texture with different parametres in the rendering.

Share this post


Link to post
Share on other sites
Hi, I think I know what the problem is.
Try this before drawing it as this works fine for me:

glDepthMask(GL_FALSE); //don't write to depth buffer
glDisable(GL_LIGHTING); //so join between box isn't seen

cheers

If it works rate me up please !!

Ade

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!