PDA

View Full Version : Skybox Problems



TheBlob
05-24-2002, 09:21 AM
Hi!
I have texturing problems with my Skybox. At the edges of the planes, which form my cube, some display errors appear. But when I align my 4 sky textures together in paint-program (like PSP) the edges appear smooth without any problems:
Here is a screenshot of my problem:
http://www.penetrator3d.de/Images/SkyBox.jpg

and here is the code for my cube:





texSky[0].Specify();
glBegin(GL_QUADS);

glTexCoord2f(0.0f,0.0f);
glVertex3f(-0.5f,-0.5f,0.0f);

glTexCoord2f(1.0f,0.0f);
glVertex3f(0.5f,-0.5f,0.0f);

glTexCoord2f(1.0f,1.0f);
glVertex3f(0.5f,-0.5f,-1.0f);

glTexCoord2f(0.0f,1.0f);
glVertex3f(-0.5f,-0.5f,-1.0f);

glEnd();


texSky[1].Specify();
glBegin(GL_QUADS);

glTexCoord2f(0.0f,0.0f);
glVertex3f(0.5f,-0.5f,0.0f);

glTexCoord2f(1.0f,0.0f);
glVertex3f(0.5f,0.5f,0.0f);

glTexCoord2f(1.0f,1.0f);
glVertex3f(0.5f,0.5f,-1.0f);

glTexCoord2f(0.0f,1.0f);
glVertex3f(0.5f,-0.5f,-1.0f);

glEnd();

texSky[2].Specify();
glBegin(GL_QUADS);

glTexCoord2f(0.0f,0.0f);
glVertex3f(0.5f,0.5f,0.0f);

glTexCoord2f(1.0f,0.0f);
glVertex3f(-0.5f,0.5f,0.0f);

glTexCoord2f(1.0f,1.0f);
glVertex3f(-0.5f,0.5f,-1.0f);

glTexCoord2f(0.0f,1.0f);
glVertex3f(0.5f,0.5f,-1.0f);

glEnd();

texSky[3].Specify();
glBegin(GL_QUADS);

glTexCoord2f(0.0f,0.0f);
glVertex3f(-0.5f,0.5f,0.0f);

glTexCoord2f(1.0f,0.0f);
glVertex3f(-0.5f,-0.5f,0.0f);

glTexCoord2f(1.0f,1.0f);
glVertex3f(-0.5f,-0.5f,-1.0f);

glTexCoord2f(0.0f,1.0f);
glVertex3f(-0.5f,0.5f,-1.0f);

glEnd();


texSky[4].Specify();
glBegin(GL_QUADS);

glTexCoord2f(0.0f,0.0f);
glVertex3f(-0.5f,-0.5f,-1.0f);

glTexCoord2f(1.0f,0.0f);
glVertex3f(0.5f,-0.5f,-1.0f);

glTexCoord2f(1.0f,1.0f);
glVertex3f(0.5f,0.5f,-1.0f);

glTexCoord2f(0.0f,1.0f);
glVertex3f(-0.5f,0.5f,-1.0f);


glEnd();


I canīt figure out the mistake...
Thanks in Advance!

TheBlob
05-24-2002, 09:24 AM
Why does my screenshot not appear??
The URL is correct: http://www.penetrator3d.de/Images/SkyBox.jpg

gumby
05-24-2002, 10:12 AM
Try GL_CLAMP_TO_EDGE for texture wrap modes.

yakuza
05-24-2002, 10:13 AM
I think this might help:

glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) and the same for WRAP_T

It's discussed rather thoroughly here: http://www.gamedev.net/community/forums/topic.asp?topic_id=95991

TheBlob
05-24-2002, 12:03 PM
Well that sounds great, but i figured out that my graphics-card doesnīt support GL_CLAMP_TO_EDGE....but itīs a GeForce1 !???! Can this be??

TheBlob
05-24-2002, 12:44 PM
Ok...I got now that i didnīt use the latest glext.h. *g* Now I can use GL_CLAMP_TO_EDGE!!
But it doesnīt help at all....:-(

yakuza
05-24-2002, 03:09 PM
There's also a pretty elaborate discussion going on in the Advanced Forum, I didn't read the whole thing but perhaps it will help you:
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/006422.html

V-man
05-24-2002, 08:30 PM
I think that had a bug on the early Geforces so clamp to edge works just like clamp.

V-man

Roquqkie
05-26-2002, 06:22 AM
Hmmm...
Why use GL_CLAMP_TO_EDGE ... Wouldnt GL_CLAMP just solve the problem?
I use GL_CLAMP which solved the problem you have!

Try it!
Btw. Nice skybox!!! http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Best regards
Roquqkie

TheBlob
05-26-2002, 06:30 AM
Ok, thanks for the replies!
GL_CLAMP and GL_CLAMP_TO_EDGE didnīt work, so I started to fake a little.
Instead of using 0.0f and 1.0f for Texture Coordinates, I tried tu use 0.0009f and 0.9991f!! This works! *g* Itīs a bad solution, but I couldīnt find a diffrent way.

Jambolo
05-27-2002, 12:15 PM
I'm not sure about this but I think it is correct -- I believe the problem is caused by filtering. With GL_CLAMP, texels on the edge are filtered with the border. If you don't have a border, then it could be black or some random color. With GL_CLAMP_TO_EDGE, texels on the are not filtered with the border.

.. or someting like that.