Well I have something rendering but its all messed up. Look at image.
http://img178.imageshack.us/img178/6717/untitled2copy2or.th.jpg
The colors are as follows
green = top
orange = bottom
red = front
yellow = back
blue = left
violet = right
those are supposed to be the correct order but as you can see my top and bottom are flipped? and why does my quads look no uniform? Guess I am lost on what to do. I am trying to make a cube to represent my lights POV frustum for my shadowmapping so I can see where the volume is aiming at on my terrain…
void CTerrain::DrawShadowFrustum(bool drawFrustum)
{
if(drawFrustum)
{
glDisable(GL_CULL_FACE);
CFrustum lightPOVFrustum = CFrustum();
glPushMatrix();
glTranslatef(0.0f, 5.0f, 0.0f);
lightPOVFrustum.calculateFrustum(modelViewMatrix, modelProjectionMatrix, false);
glBegin(GL_QUADS);
glColor3f(0.0f, 1.0f, 0.0f); // Set The Color To Green
glVertex3f( lightPOVFrustum.frustum[3][0], lightPOVFrustum.frustum[3][1], -lightPOVFrustum.frustum[3][2]); // Top Right Of The Quad (Top)
glVertex3f(-lightPOVFrustum.frustum[3][0], lightPOVFrustum.frustum[3][1], -lightPOVFrustum.frustum[3][2]); // Top Left Of The Quad (Top)
glVertex3f(-lightPOVFrustum.frustum[3][0], lightPOVFrustum.frustum[3][1], lightPOVFrustum.frustum[3][2]); // Bottom Left Of The Quad (Top)
glVertex3f( lightPOVFrustum.frustum[3][0], lightPOVFrustum.frustum[3][1], lightPOVFrustum.frustum[3][2]); // Bottom Right Of The Quad (Top)
glColor3f(1.0f, 0.5f, 0.0f); // Set The Color To Orange
glVertex3f( lightPOVFrustum.frustum[2][0], -lightPOVFrustum.frustum[2][1], lightPOVFrustum.frustum[2][2]); // Top Right Of The Quad (Bottom)
glVertex3f(-lightPOVFrustum.frustum[2][0], -lightPOVFrustum.frustum[2][1], lightPOVFrustum.frustum[2][2]); // Top Left Of The Quad (Bottom)
glVertex3f(-lightPOVFrustum.frustum[2][0], -lightPOVFrustum.frustum[2][1], -lightPOVFrustum.frustum[2][2]); // Bottom Left Of The Quad (Bottom)
glVertex3f( lightPOVFrustum.frustum[2][0], -lightPOVFrustum.frustum[2][1], -lightPOVFrustum.frustum[2][2]); // Bottom Right Of The Quad (Bottom)
glColor3f(1.0f, 0.0f, 0.0f); // Set The Color To Red
glVertex3f( lightPOVFrustum.frustum[5][0], lightPOVFrustum.frustum[5][1], lightPOVFrustum.frustum[5][2]); // Top Right Of The Quad (Front)
glVertex3f(-lightPOVFrustum.frustum[5][0], lightPOVFrustum.frustum[5][1], lightPOVFrustum.frustum[5][2]); // Top Left Of The Quad (Front)
glVertex3f(-lightPOVFrustum.frustum[5][0], -lightPOVFrustum.frustum[5][1], lightPOVFrustum.frustum[5][2]); // Bottom Left Of The Quad (Front)
glVertex3f( lightPOVFrustum.frustum[5][0], -lightPOVFrustum.frustum[5][1], lightPOVFrustum.frustum[5][2]); // Bottom Right Of The Quad (Front)
glColor3f(1.0f, 1.0f, 0.0f); // Set The Color To Yellow
glVertex3f( lightPOVFrustum.frustum[4][0], -lightPOVFrustum.frustum[4][1], -lightPOVFrustum.frustum[4][2]); // Bottom Left Of The Quad (Back)
glVertex3f(-lightPOVFrustum.frustum[4][0], -lightPOVFrustum.frustum[4][1], -lightPOVFrustum.frustum[4][2]); // Bottom Right Of The Quad (Back)
glVertex3f(-lightPOVFrustum.frustum[4][0], lightPOVFrustum.frustum[4][1], -lightPOVFrustum.frustum[4][2]); // Top Right Of The Quad (Back)
glVertex3f( lightPOVFrustum.frustum[4][0], lightPOVFrustum.frustum[4][1], -lightPOVFrustum.frustum[4][2]); // Top Left Of The Quad (Back)
glColor3f(0.0f, 0.0f, 1.0f); // Set The Color To Blue
glVertex3f(-lightPOVFrustum.frustum[1][0], lightPOVFrustum.frustum[1][1], lightPOVFrustum.frustum[1][2]); // Top Right Of The Quad (Left)
glVertex3f(-lightPOVFrustum.frustum[1][0], lightPOVFrustum.frustum[1][1], -lightPOVFrustum.frustum[1][2]); // Top Left Of The Quad (Left)
glVertex3f(-lightPOVFrustum.frustum[1][0], -lightPOVFrustum.frustum[1][1], -lightPOVFrustum.frustum[1][2]); // Bottom Left Of The Quad (Left)
glVertex3f(-lightPOVFrustum.frustum[1][0], -lightPOVFrustum.frustum[1][1], lightPOVFrustum.frustum[1][2]); // Bottom Right Of The Quad (Left)
glColor3f(1.0f, 0.0f, 1.0f); // Set The Color To Violet
glVertex3f(lightPOVFrustum.frustum[0][0], lightPOVFrustum.frustum[0][1], -lightPOVFrustum.frustum[0][2]); // Top Right Of The Quad (Right)
glVertex3f(lightPOVFrustum.frustum[0][0], lightPOVFrustum.frustum[0][1], lightPOVFrustum.frustum[0][2]); // Top Left Of The Quad (Right)
glVertex3f(lightPOVFrustum.frustum[0][0], -lightPOVFrustum.frustum[0][1], lightPOVFrustum.frustum[0][2]); // Bottom Left Of The Quad (Right)
glVertex3f(lightPOVFrustum.frustum[0][0], -lightPOVFrustum.frustum[0][1], -lightPOVFrustum.frustum[0][2]); // Bottom Right Of The Quad (Right)
glEnd();
glPopMatrix();
glEnable(GL_CULL_FACE);
}
}
BTW I am not normalizing the planes and tried and was no difference…