PDA

View Full Version : Pulling what's left of my hair out over skybox



Edward472
11-02-2010, 06:17 PM
I have been lurking here and everywhere else on the web trying to get my skybox to render. With my current code all I see is 1 texture that gets closer and farther away depending on my y view. I have no idea what my problem is. If anyone could please take a look at this code, I would be very appreciative.



void Skybox::makeSkybox(GLuint texture[])
{
glPushMatrix();
glLoadIdentity();
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_BLEND);
glColor4f(1.0, 1.0, 1.0,1.0f);

float cz = -0.0f;
float r,cx = 1.0f;

// Front
glBindTexture(GL_TEXTURE_2D,texture[1]);
glBegin(GL_QUADS);
glTexCoord2f(cx, cz); glVertex3f(-r ,1.0f,-r);
glTexCoord2f(cx, cx); glVertex3f(-r,1.0f,r);
glTexCoord2f(cz, cx); glVertex3f( r,1.0f,r);
glTexCoord2f(cz, cz); glVertex3f( r ,1.0f,-r);
glEnd();

//Back
glBindTexture(GL_TEXTURE_2D,texture[2]);
glBegin(GL_QUADS);
glTexCoord2f(cx,cz); glVertex3f(-r,-1.0f,-r);
glTexCoord2f(cx,cx); glVertex3f(-r,-1.0f, r);
glTexCoord2f(cz,cx); glVertex3f( r,-1.0f, r);
glTexCoord2f(cz,cz); glVertex3f( r,-1.0f,-r);
glEnd();

.....

zeoverlord
11-03-2010, 01:20 AM
from what i can see is that you are missing a glRotate after glLoadIdentity(); that rotates the skybox according to your camera angle.