Original Post
Hi.
I have this annoying problem, I have created 2 textured quads to act somewhat like a floor and ceiling, everything works fine until I add lighting then the quads wont show up, I have tried to add other objects to my scene and they turn up just fine so I have no clue what could be the problem.
heres some of my code:
I hope this is just some newbie error and that i can get it out of the way as fast as possible!
thanks in advance
Edited by - Load Runner on December 20, 2001 4:58:50 PM
//GLOBALS
float LightAmbient[] = {0.5f, 0.5f, 0.5f, 1.0f};
float LightDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
float LightPosition[] = {0.0f, 0.0f, 1.0f, 1.0f};
//INITGL
int InitGL(int w,int h)
{
glViewport(0, 0, w, h);
glClearColor(0.0f,0.0f,0.0f,0.5f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(float)w/(float)h,1.0,100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
LoadGLTextures();
glEnable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT1,GL_AMBIENT,LightAmbient);
glLightfv(GL_LIGHT1,GL_DIFFUSE,LightDiffuse);
glLightfv(GL_LIGHT1,GL_POSITION,LightPosition);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
return TRUE;
}
//RENDERSCENE
int RenderGLScene()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D,Texture[0]);
glBegin(GL_QUADS);
//TOP QUAD
glNormal3f(0.0f,-1.0f,0.0f);
glTexCoord2f(0,0); glVertex3f( 10.0f,1.0f, 0.0f); //BL
glTexCoord2f(1,0); glVertex3f(-10.0f,1.0f, 0.0f); //BR
glTexCoord2f(1,1); glVertex3f(-10.0f,1.0f,-20.0f); //TR
glTexCoord2f(0,1); glVertex3f( 10.0f,1.0f,-20.0f); //TL
//BOTTOM QUAD
glNormal3f(0.0f,1.0f,0.0f);
glTexCoord2f(0,0); glVertex3f(-10.0f,-1.0f, 0.0f); //BL
glTexCoord2f(1,0); glVertex3f( 10.0f,-1.0f, 0.0f); //BR
glTexCoord2f(1,1); glVertex3f( 10.0f,-1.0f,-20.0f); //TR
glTexCoord2f(0,1); glVertex3f(-10.0f,-1.0f,-20.0f); //TL
glEnd();
return TRUE;
}
|