I have the following code to draw a scene to opengl, but nothing shows up, just a blank screen!
void glCameraDraw(const LABglCameraHANDLE h, LABglWindowHANDLE LABglGlobals)
{
if (!h->isProjected)//check to see if h's projection is loaded
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//LABglGlobals->LABglDimensions are the screen dimensions
gluPerspective(h->fov,(float)LABglGlobals->LABglDimensions.right/
(float)LABglGlobals->LABglDimensions.bottom,
h->front,h->back);
h->isProjected=true;
}
//set the viewport
glViewport(0,0,LABglGlobals->LABglDimensions.right,LABglGlobals->LABglDimensions.bottom);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
//move and rotate as per the rules in my camera
glTranslatef(-h->loc.x,-h->loc.y,-h->loc.z);
glRotatef(h->rot.pitch,1,0,0);
glRotatef(h->rot.yaw, 0,1,0);
glRotatef(h->rot.roll, 0,0,1);
//loop through the models in the window (they are stored as array of pointer to pointer
for (int i=0; i<LABglGlobals->LABglNumModels; ++i)
{
if (*(LABglGlobals->LABglModels[i]))//check that this particular model exists
{
glLoadIdentity();
//bind this model's texture
glBindTexture(GL_TEXTURE_2D,(*(LABglGlobals->LABglModels[i]))->texture->glTexture);
//set the color
glColor4b(((*(LABglGlobals->LABglModels[i]))->blend&0xFF000000)>>24,
((*(LABglGlobals->LABglModels[i]))->blend&0x00FF0000)>>16,
((*(LABglGlobals->LABglModels[i]))->blend&0x0000FF00)>>8,
((*(LABglGlobals->LABglModels[i]))->blend&0x000000FF));
glCallList((*(LABglGlobals->LABglModels[i]))->displayList);//call the precomiled display list
}
}
SwapBuffers(LABglGlobals->LABglhDC);
}
I cannot see what is wrong with that code? Any ideas.