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();
Lines at joining of textures in skybox
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
Any idea as to how to remove the seam/lines ?
Thanks
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.
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.
I think it doesnt matter what you use for loading the images.
Just do:
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.
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.
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.
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.
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.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement