PDA

View Full Version : skybox - glTexParameteri - problem



Floppy29
07-29-2012, 04:09 AM
hello,

atm im at building a skybox with opengl.
My problem is, that i can see the edges in black all the time.

Glext.h is includes.

Please have a short look at my 2 functions, drawscene and the textureloader.
Thanks for your help.


loader:


//... loaded with SOIL

// Typical Texture Generation Using Data From The Bitmap
//glBindTexture(GL_TEXTURE_2D, texture[0]);
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

//...


drawscene:


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View

glRotatef(r, 0, 1, 0);

glDisable(GL_DEPTH_TEST);
// front
glBindTexture(GL_TEXTURE_2D, texture[1]);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f( 0.5f, -0.5f, -0.5f );
glTexCoord2f(1, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
glTexCoord2f(1, 1); glVertex3f( -0.5f, 0.5f, -0.5f );
glTexCoord2f(0, 1); glVertex3f( 0.5f, 0.5f, -0.5f );
glEnd();
// left
// back
// right
glBindTexture(GL_TEXTURE_2D, texture[2]);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
glTexCoord2f(1, 0); glVertex3f( -0.5f, -0.5f, 0.5f );
glTexCoord2f(1, 1); glVertex3f( -0.5f, 0.5f, 0.5f );
glTexCoord2f(0, 1); glVertex3f( -0.5f, 0.5f, -0.5f );
glEnd();
// top
// bottom
glEnable(GL_DEPTH_TEST);

glTranslatef(lr, 0.0f, ou);

//...



Pic: http://s7.directupload.net/file/d/2966/9bjlabd5_jpg.htm

V-man
07-30-2012, 05:37 AM
Are you using 2D or cubemap texturing? In any case, GL_CLAMP_TO_EDGE is the solution. If it doesnt work, you have a bug somewhere and test it on another PC.