# Lines at joining of textures in skybox

This topic is 4761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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();
glBindTexture(GL_TEXTURE_2D, texture[FRONT]);

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[RIGHT]);
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[LEFT]);
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]);
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]);
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]);
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 on other sites
Try GL_CLAMP_TO_EDGE as wrap mode for all textures.

##### Share on other sites
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 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 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 on other sites
I did say for ALL textures, didn't I?

##### 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 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 !!

##### Share on other sites

This topic is 4761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.