示例#1
0
void display(void)
{
ReadData();
  glutSetWindow(id1);
  /* clear all pixels, clear depth bit */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
  /* set up projection transformation */
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  /* for perspective projection specify a viewing frustum */
  glFrustum(JPOT$1, JPOT$2, JPOT$3, JPOT$4, JPOT$5, JPOT$6);

  /* set up viewing transformation */
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  /* specify viewpoint */
  gluLookAt(JPOT$7, JPOT$8, JPOT$9, JPOT$10, JPOT$11, JPOT$12, JPOT$13, JPOT$14, JPOT$15);

  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) tmat);
  transpose(tmat);
  inverse(tmat);
  transpose(tmat);
  glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_green);
  glutSolidTeapot(1.0);
  drawaxes();

  glFlush();
}
示例#2
0
文件: MatEmiss.c 项目: McNeight/GLsat
void display()
{ 
  if (ALIASMODE == 0) {
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_LINE_SMOOTH);
    glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);  
   }
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);   
  glLoadIdentity();          /* clear the matrix */
  gluLookAt(2, 4, 5, 0 , 0 , 0, 0, 1, 0);
  
  glMaterialfv(GL_FRONT, GL_AMBIENT, material_ambient);
  glMaterialfv(GL_FRONT, GL_DIFFUSE, material_diffuse);  
  glMaterialfv(GL_FRONT, GL_SPECULAR, material_specular);
  glMaterialfv(GL_FRONT, GL_SHININESS, material_shininess);
  /*$$$
  [Red, f, 0.0, 0.0, 1.0, c], [Green, f, 0.0, 0.0, 1.0, c],[Blue, f, 0.0, 0.0, 1.0, c]
  $$$*/
  material_emission[0] = JPOT$1;
  material_emission[1] = JPOT$2;
  material_emission[2] = JPOT$3;
  glMaterialfv(GL_FRONT, GL_EMISSION, material_emission);
  glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);

  drawaxes();
  glTranslatef(0, 0, -3);
  glutSolidSphere(1.0, 30, 30);;
  glFlush();
}
示例#3
0
void display1()
{	
  glutSetWindow(id1);
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
         
  /*$$$
    [Frus-left, f, -1.0, -5.0, 5.0, c],
    [Frus-right, f, 1.0, -5.0, 5.0, c],
    [Frus-bottom, f, -1.0, -5.0, 5.0, c],
    [Frus-top, f, 1.0, -5.0, 5.0, n],
    [Frus-near, f, 2.0, 0.1, 20.0, c],
    [Frus-far, f, 20.0, 0.1, 30.0, c]
    $$$*/
  glFrustum(JPOT$1, JPOT$2, JPOT$3, JPOT$4, JPOT$5, JPOT$6);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(2, 4, 10, 0 , 0 , 0, 0, 1, 0);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);	
  
  drawtable();
  drawaxes();
  drawpot();

  glTranslatef(2, 0,- 10);
  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_red);
  glutSolidSphere(1.0, 40, 40);

  glFlush();
}
示例#4
0
void display2()
{	
  glutSetWindow(id2);
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();  
       
  /*$$$
    [Orth-left, f, -5.0, -10.0, 10.0, n],
    [Orth-right, f, 5.0, -10.0, 10.0, c],
    [Orth-bottom, f, -5.0, -10.0, 10.0, c],
    [Orth-top, f, 5.0, -10.0, 10.0, n],
    [Orth-near, f, 2.0, -10.0, 10.0, c],
    [Orth-far, f, 20.0, 10.0, 30.0, c]
    $$$*/
  glOrtho(JPOT$7, JPOT$8, JPOT$9, JPOT$10, JPOT$11, JPOT$12);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(2, 4, 10, 0 , 0 , 0, 0, 1, 0);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);	
  
  drawtable();
  drawaxes();
  drawpot();

  glTranslatef(2, 0,- 10);
  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_red);
  glutSolidSphere(1.0, 40, 40);

  glFlush();
}
示例#5
0
void display(void) {
    glClear (GL_COLOR_BUFFER_BIT);
    glColor3f (1.0, 1.0, 1.0);
    drawaxes(WMIN, WMAX, 100,10);
    Draw(Tree.first);
    //midpointcircle(10, 100, 100 , 0, WMAX);
    //drawline(10, 40, 30, 100, 0, 200);
    glFlush ();
}
示例#6
0
文件: main.cpp 项目: ajanaliz/BasicGL
void display(){
	glClear(GL_COLOR_BUFFER_BIT);
	drawaxes();




	glFlush();

}
示例#7
0
void display()
{ 
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);   
  glLoadIdentity(); 
  gluLookAt(2, 4, 5, 0 , 0 , 0, 0, 1, 0);
  glMaterialfv(GL_FRONT, GL_AMBIENT, material_ambient);
  glMaterialfv(GL_FRONT, GL_DIFFUSE, material_diffuse);  
  glMaterialfv(GL_FRONT, GL_SPECULAR, material_specular);
  glMaterialfv(GL_FRONT, GL_SHININESS, material_shininess);
  glMaterialfv(GL_FRONT, GL_EMISSION, material_emission);
  /*$$$
    [Light X, f, 1.0, -10.0, 10.0, c], 
    [Light Y, f, 1.0, -10.0, 10.0, c],
    [Light Z, f, 1.0, -10.0, 10.0, c],
    [Light W, f, 1.0, 0.0, 1.0, c]
    $$$*/
  light_position[0] =JPOT$1; light_position[1] = JPOT$2; light_position[2] = JPOT$3; light_position[3] = JPOT$4;
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  /*$$$
    [Amb_Red, f, 0.0, 0.0, 1.0, n],
    [Amb_Green, f, 0.0, 0.0, 1.0, c],
    [Amb_Blue, f, 0.0, 0.0, 1.0, c]$$$*/
  light_ambient[0] =JPOT$5; light_ambient[1] = JPOT$5; light_ambient[2] = JPOT$7;
  glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
  /*$$$
    [Diff_Red, f, 1.0, 0.0, 1.0, n], 
    [Diff_Green, f, 1.0, 0.0, 1.0, c],
    [Diff_Blue, f, 1.0, 0.0, 1.0, c]
    $$$*/
  light_diffuse[0] =JPOT$8; light_diffuse[1] = JPOT$9; light_diffuse[2] = JPOT$10;
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  /*$$$
    [Spec_Red, f, 1.0, 0.0, 1.0, n], 
    [Spec_Green, f, 1.0, 0.0, 1.0, c],
    [Spec_Blue, f, 1.0, 0.0, 1.0, c]
  $$$*/
  light_specular[0] = JPOT$11; light_specular[1] = JPOT$12; light_specular[2] = JPOT$13;
  glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
  glPushMatrix();
    glTranslatef(light_position[0], light_position[1], light_position[2] - 0.2);
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_red);
    glScalef(0.1, 0.1, 0.1);
    glutSolidSphere(1.0, 8, 8);
  glPopMatrix();
  drawaxes();
  glTranslatef(0, 0, -3);
  glutSolidTeapot(1.0);
  glFlush();
}
示例#8
0
void display(void)
{
  glutSetWindow(id1);
  /* clear all pixels, clear depth bit */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
  /* set up projection transformation */
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  /* for perspective projection specify a viewing frustum */
  /*$$$
    [left, f, -1.0, -10.0, 10.0, c],
    [right, f, 1.0, -10.0, 10.0, c],
    [bottom, f, -1.0, -10.0, 10.0, c],
    [top, f, 1.0, -10.0, 10.0, n],
    [near, f, 2.0, 0.1, 20.0, c],
    [far, f, 20.0, 0.1, 30.0, c]
    $$$*/
  glFrustum(JPOT$1, JPOT$2, JPOT$3, JPOT$4, JPOT$5, JPOT$6);

  /* set up viewing transformation */
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  /* specify viewpoint */
  /*$$$
    [eye-x, f, 2.0, -10, 10, n],
    [eye-y, f, 4.0, -10, 10, c],
    [eye-z, f, 13.0, -20, 20, c],
    [center-x, f, 0.0, -5.0, 5.0, n],
    [center-y, f, 0.0, -5.0, 5.0, c],
    [center-z, f, 0.0, -5.0, 5.0, c],
    [up-x, f, 0, -1.0, 1.0, n],
    [up-y, f, 1.0, -1.0, 1.0, c],
    [up-z, f, 0.0, -1.0, 1.0, c]
    $$$*/
  gluLookAt(JPOT$7, JPOT$8, JPOT$9, JPOT$10, JPOT$11, JPOT$12, JPOT$13, JPOT$14, JPOT$15);

  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) tmat);
  transpose(tmat);
  inverse(tmat);
  transpose(tmat);
  glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_green);
  glutSolidTeapot(1.0);
  drawaxes();

  glFlush();
}
示例#9
0
文件: Scale.c 项目: McNeight/GLsat
void display()
{ 
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);   
  /* clear the matrix */
  glLoadIdentity();         
  gluLookAt(5, 5, 10, 0 , 0 , 0, 0, 1, 0);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  drawaxes();
  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_green);

  /*$$$
   [X, f, 1.0, -5.0, 5.0, n], [Y, f, 1.0, -5.0, 5.0, c], [Z, f, 1.0, -5.0, 5.0, c]
    $$$*/
  glScalef(JPOT$1, JPOT$2, JPOT$3);
  glutSolidTeapot(1.0);
  drawlocalaxes();

  glFlush();
}
示例#10
0
void display()
{ 
ReadData();
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glEnable(GL_DEPTH_TEST);
  glShadeModel(GL_SMOOTH);   
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glLoadIdentity();
if (JPOT$swap == 1) {
  gluLookAt(2, 4, 15, 0 , 0 , 0, 0, 1, 0);
} /*end swap*/
if (JPOT$swap == 0) {
  gluLookAt(-2, 4, -15, 0, 0, 0, 0, 1, 0);
} /*end swap*/
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  drawaxes();
  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_green);
  glutSolidTeapot(1.0);
  glFlush();
}
示例#11
0
void
world_display(void)
{
    GLfloat light_pos[] = { 0.0, 0.0, 1.0, 0.0 };
    double length;
    float l[3];
    
    l[0] = lookat[3].value - lookat[0].value; 
    l[1] = lookat[4].value - lookat[1].value; 
    l[2] = lookat[5].value - lookat[2].value;
    length = normalize(l);
    
    invert(modelview, inverse);
    
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    if (world_draw) {
        glEnable(GL_LIGHTING);
        glPushMatrix();
        glMultMatrixd(inverse);
        glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
        glPopMatrix();
        drawmodel();
        glDisable(GL_LIGHTING);
    }
    
    glPushMatrix();
    
    glMultMatrixd(inverse);
    
    glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
    
    /* draw the axis and eye vector */
    glPushMatrix();
    glColor3ub(0, 0, 255);
    glBegin(GL_LINE_STRIP);
    glVertex3f(0.0, 0.0, 0.0);
    glVertex3f(0.0, 0.0, -1.0*length);
    glVertex3f(0.1, 0.0, -0.9*length);
    glVertex3f(-0.1, 0.0, -0.9*length);
    glVertex3f(0.0, 0.0, -1.0*length);
    glVertex3f(0.0, 0.1, -0.9*length);
    glVertex3f(0.0, -0.1, -0.9*length);
    glVertex3f(0.0, 0.0, -1.0*length);
    glEnd();
    glColor3ub(255, 255, 0);
    glRasterPos3f(0.0, 0.0, -1.1*length);
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'e');
    glColor3ub(255, 0, 0);
    glScalef(0.4, 0.4, 0.4);
    drawaxes();
    glPopMatrix();
    
    invert(projection, inverse);
    glMultMatrixd(inverse);
    
    /* draw the viewing frustum */
    glColor3f(0.2, 0.2, 0.2);
    glBegin(GL_QUADS);
    glVertex3i(1, 1, 1);
    glVertex3i(-1, 1, 1);
    glVertex3i(-1, -1, 1);
    glVertex3i(1, -1, 1);
    glEnd();
    
    glColor3ub(128, 196, 128);
    glBegin(GL_LINES);
    glVertex3i(1, 1, -1);
    glVertex3i(1, 1, 1);
    glVertex3i(-1, 1, -1);
    glVertex3i(-1, 1, 1);
    glVertex3i(-1, -1, -1);
    glVertex3i(-1, -1, 1);
    glVertex3i(1, -1, -1);
    glVertex3i(1, -1, 1);
    glEnd();
    
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glColor4f(0.2, 0.2, 0.4, 0.5);
    glBegin(GL_QUADS);
    glVertex3i(1, 1, -1);
    glVertex3i(-1, 1, -1);
    glVertex3i(-1, -1, -1);
    glVertex3i(1, -1, -1);
    glEnd();
    glDisable(GL_BLEND);
    
    glPopMatrix();
    glutSwapBuffers();
}
示例#12
0
void
world_display(void)
{
    double length;
    float l[3];
    GLfloat pos[4], lKa[4], lKd[4], lKs[4];
    GLfloat dir[3], mKa[4], mKd[4], mKs[4], mKe[4];
    GLfloat lmKa[4];

    cell_vector(pos, light_pos, 4);
    cell_vector(lKa, light_Ka, 4);
    cell_vector(lKd, light_Kd, 4);
    cell_vector(lKs, light_Ks, 4);
    cell_vector(dir, spot_direction, 3);
    cell_vector(mKa, material_Ka, 4);
    cell_vector(mKd, material_Kd, 4);
    cell_vector(mKs, material_Ks, 4);
    cell_vector(mKe, material_Ke, 4);
    cell_vector(lmKa, lmodel_Ka, 4);

    glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, local_viewer.value);
    glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, two_side.value);
    glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmKa);

    glMaterialfv(GL_FRONT, GL_AMBIENT, mKa);
    glMaterialfv(GL_FRONT, GL_DIFFUSE, mKd);
    glMaterialfv(GL_FRONT, GL_SPECULAR, mKs);
    glMaterialfv(GL_FRONT, GL_EMISSION, mKe);
    glMaterialf(GL_FRONT, GL_SHININESS, material_Se.value);

    glLightfv(GL_LIGHT0, GL_AMBIENT, lKa);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, lKd);
    glLightfv(GL_LIGHT0, GL_SPECULAR, lKs);
    glLighti(GL_LIGHT0, GL_SPOT_EXPONENT, (int)spot_exponent.value);
    if (spot_cutoff.value > 90)
        glLighti(GL_LIGHT0, GL_SPOT_CUTOFF, 180);
    else
        glLighti(GL_LIGHT0, GL_SPOT_CUTOFF, (int)spot_cutoff.value);
    glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, Kc.value);
    glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, Kl.value);
    glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, Kq.value);

    l[0] = at[0] - eye[0];
    l[1] = at[1] - eye[1];
    l[2] = at[2] - eye[2];

    invert(modelview, inverse);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();
    glMultMatrixd(inverse);
    glTranslatef(l[0], l[1], l[2]);
    glColor3fv(lKd);
    glBegin(GL_LINE_STRIP);
    if (spot_cutoff.value > 90)
        glVertex3f(0, 0, 0);
    else
        glVertex3f(pos[0]+spot_direction[0].value,
                   pos[1]+spot_direction[1].value,
                   pos[2]+spot_direction[2].value);

    if (pos[3] == 0)        /* 10.0 = 'infinite' light */
        glVertex3f(pos[0]*10.0,pos[1]*10.0,pos[2]*10.0);
    else
        glVertex3f(pos[0], pos[1], pos[2]);
    glEnd();
    glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir);
    glLightfv(GL_LIGHT0, GL_POSITION, pos);
    glPopMatrix();

    length = normalize(l);

    if (world_draw) {
        glEnable(GL_LIGHTING);
        if (pmodel)
            drawmodel();
        else
            glutSolidTorus(0.25, 0.75, 28, 28);
        glDisable(GL_LIGHTING);
    }

#if 0
#define TESS 20
    glNormal3f(0.0, 1.0, 0.0);
    for (i = 0; i < TESS; i++) {
        glBegin(GL_TRIANGLE_STRIP);
        for (j = 0; j <= TESS; j++) {
            glVertex3f(-1+(float)i/TESS*2, -1.0, -1+(float)j/TESS*2);
            glVertex3f(-1+(float)(i+1)/TESS*2, -1.0, -1+(float)j/TESS*2);
        }
        glEnd();
    }
#endif

    glPushMatrix();
    glMultMatrixd(inverse);

    /* draw the axis and eye vector */
    glPushMatrix();
    glColor3ub(0, 0, 255);
    glBegin(GL_LINE_STRIP);
    glVertex3f(0.0, 0.0, 0.0);
    glVertex3f(0.0, 0.0, -1.0*length);
    glVertex3f(0.1, 0.0, -0.9*length);
    glVertex3f(-0.1, 0.0, -0.9*length);
    glVertex3f(0.0, 0.0, -1.0*length);
    glVertex3f(0.0, 0.1, -0.9*length);
    glVertex3f(0.0, -0.1, -0.9*length);
    glVertex3f(0.0, 0.0, -1.0*length);
    glEnd();
    glColor3ub(255, 255, 0);
    glRasterPos3f(0.0, 0.0, -1.1*length);
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'e');
    glColor3ub(255, 0, 0);
    glScalef(0.4, 0.4, 0.4);
    drawaxes();
    glPopMatrix();

    invert(projection, inverse);
    glMultMatrixd(inverse);

    /* draw the viewing frustum */
    glColor3f(0.2, 0.2, 0.2);
    glBegin(GL_QUADS);
    glVertex3i(1, 1, 1);
    glVertex3i(-1, 1, 1);
    glVertex3i(-1, -1, 1);
    glVertex3i(1, -1, 1);
    glEnd();

    glColor3ub(128, 196, 128);
    glBegin(GL_LINES);
    glVertex3i(1, 1, -1);
    glVertex3i(1, 1, 1);
    glVertex3i(-1, 1, -1);
    glVertex3i(-1, 1, 1);
    glVertex3i(-1, -1, -1);
    glVertex3i(-1, -1, 1);
    glVertex3i(1, -1, -1);
    glVertex3i(1, -1, 1);
    glEnd();

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glColor4f(0.2, 0.2, 0.4, 0.5);
    glBegin(GL_QUADS);
    glVertex3i(1, 1, -1);
    glVertex3i(-1, 1, -1);
    glVertex3i(-1, -1, -1);
    glVertex3i(1, -1, -1);
    glEnd();
    glDisable(GL_BLEND);

    glPopMatrix();
    glutSwapBuffers();
}
示例#13
0
/*display 2*/
void display2(void)
{  
ReadData();
  glutSetWindow(id2);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  glLoadIdentity();
  /* specify viewpoint */
  gluLookAt(viewer[0], viewer[1], viewer[2], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);	
  glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_green);
  glutSolidTeapot(1.0);
  drawaxes();   
  if (inverse_exist == 0) {
    glPushMatrix();
    glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff_white);
    for (i = 0; i < 4; i++)
      for (j = 0; j < 4; j++)
      matrix[i*4+j] = tmat[i][j];
    glMultMatrixf(matrix);
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    glLineWidth(2.0);
    /* draw the actual frustum */
    left_far  = ( JPOT$1 * JPOT$6 ) / JPOT$5;
    right_far  = ( JPOT$2* JPOT$6 ) / JPOT$5;
    top_far    = ( JPOT$4 * JPOT$6 ) / JPOT$5;
    bottom_far = ( JPOT$3 * JPOT$6 ) / JPOT$5;  
 
    /* Draw the front face of the frustum */
    glBegin(GL_POLYGON);
    glVertex3f(JPOT$1, JPOT$4, -JPOT$5);
    glVertex3f(JPOT$1, JPOT$3, -JPOT$5);
    glVertex3f(JPOT$2, JPOT$3, -JPOT$5);
    glVertex3f(JPOT$2, JPOT$4, -JPOT$5);
    glEnd();
    
    /* Draw the left face of the frustum */
    glBegin(GL_POLYGON);
    glVertex3f(left_far, bottom_far,  -JPOT$6);
    glVertex3f(JPOT$1, JPOT$3,  -JPOT$5);
    glVertex3f(JPOT$1, JPOT$4, -JPOT$5);
    glVertex3f(left_far, top_far, -JPOT$6);
    glEnd();
    
    /* Draw the right face of the frustum */
    glBegin(GL_POLYGON);
    glVertex3f(right_far, bottom_far, -JPOT$6);
    glVertex3f(JPOT$2, JPOT$3, -JPOT$5);
    glVertex3f(JPOT$2, JPOT$4, -JPOT$5);
    glVertex3f(right_far, top_far, -JPOT$6);
    glEnd();
    
    /* Draw the bottom face of the frustum */
    glBegin(GL_POLYGON);
    glVertex3f(JPOT$1, JPOT$3, -JPOT$5);
    glVertex3f(left_far, bottom_far, -JPOT$6);
    glVertex3f(right_far, bottom_far, -JPOT$6);
    glVertex3f(JPOT$2, JPOT$3, -JPOT$5);
    glEnd();
    
    /* Draw the top face of the frustum */
    glBegin(GL_POLYGON);
    glVertex3f(JPOT$1, JPOT$4, -JPOT$5);
    glVertex3f(left_far, top_far, -JPOT$6);
    glVertex3f(right_far, top_far, -JPOT$6);
    glVertex3f(JPOT$2, JPOT$4, -JPOT$5);
    glEnd();

    /* Draw the back face of the frustum */
    glBegin(GL_POLYGON);
    glVertex3f(left_far, top_far, -JPOT$6);
    glVertex3f(left_far, bottom_far, -JPOT$6);
    glVertex3f(right_far, bottom_far, -JPOT$6);
    glVertex3f(right_far, top_far, -JPOT$6);
    glEnd();
    
    /* Draw the Left Triangle */
    glBegin(GL_TRIANGLES);
    glVertex3f(JPOT$1, JPOT$3, -JPOT$5);
    glVertex3f(0,0,0);
    glVertex3f(JPOT$1, JPOT$4, -JPOT$5);
    glEnd();
    
    /* Draw the top Triangle */
    glBegin(GL_TRIANGLES);
    glVertex3f(JPOT$1, JPOT$4, -JPOT$5);
    glVertex3f(0,0,0);
    glVertex3f(JPOT$2, JPOT$4, -JPOT$5);
    glEnd();
    
    /* draw the right Triangle */
    glBegin(GL_TRIANGLES);
    glVertex3f(JPOT$2, JPOT$3, -JPOT$5);
    glVertex3f(0,0,0);
    glVertex3f(JPOT$2, JPOT$4, -JPOT$5);
    glEnd();
    
    /* draw the bottom triangle */
    glBegin(GL_TRIANGLES);
    glVertex3f(JPOT$1, JPOT$3, -JPOT$5);
    glVertex3f(0,0,0);
    glVertex3f(JPOT$2, JPOT$3, -JPOT$5);
    glEnd();
    glPopMatrix();
  } 
  glFlush();
}