NOMADMAN
Jun 16th, 2002, 05:35 PM
This is from the cube class (cube.cpp)
float r, g, b, a;
float x, y, z;
glBegin(GL_QUADS);
// These vertices create the Back Side (BkBmL BkBmR BkTL BkTR)
// ( 0, 1, 2, 3 )
point[0].GetColor(r, g, b, a); point[0].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[1].GetColor(r, g, b, a); point[1].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[2].GetColor(r, g, b, a); point[2].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[3].GetColor(r, g, b, a); point[3].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
// These vertices create the Front Side (FBmL FBmR FTL FTR)
// ( 4, 5, 6, 7 )
point[4].GetColor(r, g, b, a); point[4].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[5].GetColor(r, g, b, a); point[5].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[6].GetColor(r, g, b, a); point[6].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[7].GetColor(r, g, b, a); point[7].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
// These vertices create the Bottom Face (BkBmL BkBmR FBmL FBmR)
// ( 0, 1, 4, 5 )
point[0].GetColor(r, g, b, a); point[0].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[1].GetColor(r, g, b, a); point[1].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[4].GetColor(r, g, b, a); point[4].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[5].GetColor(r, g, b, a); point[5].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
// These vertices create the Top Face (BkTL BkTR FTL FTR)
// ( 2, 3, 6, 7 )
point[2].GetColor(r, g, b, a); point[2].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[3].GetColor(r, g, b, a); point[3].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[6].GetColor(r, g, b, a); point[6].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[7].GetColor(r, g, b, a); point[7].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
// These vertices create the Left Face (BkBmL BkTL FBmL FTL)
// ( 0, 2, 4, 6 )
point[0].GetColor(r, g, b, a); point[0].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[2].GetColor(r, g, b, a); point[2].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[4].GetColor(r, g, b, a); point[4].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[6].GetColor(r, g, b, a); point[6].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
// These vertices create the Right Face (BkBmR BkTR FBmR FTR)
// ( 1, 3, 5, 7 )
point[1].GetColor(r, g, b, a); point[1].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[3].GetColor(r, g, b, a); point[3].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[5].GetColor(r, g, b, a); point[5].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
point[7].GetColor(r, g, b, a); point[7].GetCorner(x, y, z);
glColor3ub(r, g, b); glVertex3f(x, y, z);
glEnd();
}
point is an array of corner s another class. It hold 3d point and color info. GetColoe and GetCorner have all &reference vars.