Example #1
0
File: select.c Project: roymuste/Qt
void drawScene(void) {
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(40.0,4.0/3.0,1.0,100.0);
    glColor3f(0.0,1.0,0.0); // green triangle
    drawTriangle(2.0,2.0,3.0,2.0,2.5,3.0,-5.0);
    glColor3f(1.0,0.0,0.0); // red triangle
    drawTriangle(2.0,7.0,3.0,7.0,2.5,8.0,-5.0);
    glColor3f(1.0,1.0,0.0); // yellow triangles
    drawTriangle(2.0,2.0,3.0,2.0,2.5,3.0,0.0);
    drawTriangle(2.0,2.0,3.0,2.0,2.5,3.0,-10.0);
    drawViewVolume(0.0,5.0,0.0,5.0,0.0,10.0);
}
Example #2
0
/* drawScene draws 4 triangles and a wire frame
 * which represents the viewing volume.
 */
static void drawScene (void)
{
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();
   gluPerspective (40.0, 4.0/3.0, 1.0, 100.0);

   glMatrixMode (GL_MODELVIEW);
   glLoadIdentity ();
   gluLookAt (7.5, 7.5, 12.5, 2.5, 2.5, -5.0, 0.0, 1.0, 0.0);
   glColor3f (0.0, 1.0, 0.0);	/*  green triangle	*/
   drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, -5.0);
   glColor3f (1.0, 0.0, 0.0);	/*  red triangle	*/
   drawTriangle (2.0, 7.0, 3.0, 7.0, 2.5, 8.0, -5.0);
   glColor3f (1.0, 1.0, 0.0);	/*  yellow triangles	*/
   drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, 0.0);
   drawTriangle (2.0, 2.0, 3.0, 2.0, 2.5, 3.0, -10.0);
   drawViewVolume (0.0, 5.0, 0.0, 5.0, 0.0, 10.0);
}