//This is the HUD
void text ()
{
    sprintf(text1,"left_down:%.2f,%.2f left_up:%.2f,%.2f",cursor1.left_down.x,cursor1.left_down.y, cursor1.left_up.x, cursor1.left_up.y);
    glutPrint (0.0,20.0, GLUT_BITMAP_HELVETICA_12, text1, 1.0f,0.0f,0.0f, 0.5f);

    sprintf(text2,"right_down:%.2f,%.2f right_up: %.2f,%.2f",cursor1.right_down.x, cursor1.right_down.y,cursor1.right_up.x, cursor1.right_up.y);
    glutPrint (0.0,10.0, GLUT_BITMAP_HELVETICA_12, text2, 1.0f,0.0f,0.0f, 0.5f);

    sprintf(text3,"button no.%i: %.2f, %.2f",cursor1.selected_object,objects[cursor1.selected_object].current.x,objects[cursor1.selected_object].current.y);
    glutPrint (0.0,0.0, GLUT_BITMAP_HELVETICA_12, text3, 1.0f,0.0f,0.0f, 0.5f);



}
Пример #2
0
void printTextRGB( const float& x, const float& y, const string& cad, const RGB rgb )
{
	char c[256];
	strcpy_s( c, cad.c_str() );
	glutPrint(x, y, c , rgb.r, rgb.g, rgb.b, 255);
	changeColorRGB(actualColor);
}
Пример #3
0
void HUD::operate(int kill,int remaining) {
	
	glDisable(GL_CULL_FACE);
	glDisable(GL_DEPTH_TEST);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glDisable(GL_ALPHA_TEST);

	glClear(GL_DEPTH_BUFFER_BIT);
  
	glViewport(0, 0, screen_width, screen_height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, screen_width, screen_height, 0, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	
	glLoadIdentity();
	glEnable(GL_TEXTURE_2D);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexImage2D(GL_TEXTURE_2D, 0, 4, u2, v2, 0, GL_RGBA, GL_UNSIGNED_BYTE, &crosshair[0]);
	glColor4ub(255, 255, 255, 255);
	int offsetW = screen_width/2;
	int offsetH = screen_height/2;	
	 glBegin(GL_QUADS);
	 glTexCoord2d( 0,  0); glVertex2f(offsetW - width/2,offsetH - height/2);
	 glTexCoord2d(u3,  0); glVertex2f(offsetW + width/2,offsetH - height/2);
	 glTexCoord2d(u3, v3); glVertex2f(offsetW + width/2,offsetH + height/2);
	 glTexCoord2d( 0, v3); glVertex2f(offsetW - width/2, offsetH + height/2);
	 glEnd();
	 glDisable(GL_TEXTURE_2D);

	 glutPrint(0, 18,combineChar("Kill Count",itoa(kill,buffer,10)), 0.0f, 1.0f, 0.0f, 1.0f);
	 glutPrint(0, 36,itoa(remaining,buffer,10), 0.0f, 1.0f, 0.0f, 1.0f);

	glViewport(0, 0, screen_width, screen_height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0, GLdouble (screen_width), 0, GLdouble (screen_height));
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glEnable(GL_CULL_FACE);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_ALPHA_TEST);
	glDisable(GL_BLEND);
		
}
//This is the HUD
void text ()
{
    sprintf(text1,"mouse=left_down:%.2f,%.2f left_up:%.2f,%.2f",cursor1.left_down.x,cursor1.left_down.y, cursor1.left_up.x, cursor1.left_up.y);
    glutPrint (0.0,20.0, GLUT_BITMAP_HELVETICA_12, text1, 1.0f,0.0f,0.0f, 0.5f);

    if(button1.selected==true)
    {
        sprintf(text2,"button1=%.3f , %.3f",button1.current.x,button1.current.y);
        glutPrint (0.0,10.0, GLUT_BITMAP_HELVETICA_12, text2, 1.0f,0.0f,0.0f, 0.5f);
    }

    if(button2.selected==true)
    {
        sprintf(text2,"button1=%.3f , %.3f",button2.current.x,button2.current.y);
        glutPrint (0.0,0.0, GLUT_BITMAP_HELVETICA_12, text2, 1.0f,0.0f,0.0f, 0.5f);
    }


}
//This is the HUD
void text ()
{
    sprintf(text1,"mouse=%i , %i",mouse_x,mouse_y);
    glutPrint (0.0,20.0, GLUT_BITMAP_HELVETICA_12, text1, 1.0f,0.0f,0.0f, 0.5f);

    if(button1.active==true)
    {
        sprintf(text2,"button1=%.3f , %.3f",button1.current.x,button1.current.y);
        glutPrint (0.0,10.0, GLUT_BITMAP_HELVETICA_12, text2, 1.0f,0.0f,0.0f, 0.5f);
    }

    if(button2.active==true)
    {
        sprintf(text2,"button1=%.3f , %.3f",button2.current.x,button2.current.y);
        glutPrint (0.0,0.0, GLUT_BITMAP_HELVETICA_12, text2, 1.0f,0.0f,0.0f, 0.5f);
    }


}
Пример #6
0
void glutPrintxy(float x,float y,char *str)
{
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glLoadIdentity();

	glRasterPos2f(x,y);
	glutPrint(str);

	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
} /* glutPrint */ 
Пример #7
0
void display( void ){
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    mat4 mv = RotateY(Theta[Yaxis]) * RotateX(Theta[Xaxis]);
    mat4 rot;

    glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );

    int i,j,k;
    int offset_points=0;
    int offset_bytes=0;

    int num_points = myCube->getNumPoints();

    points = myCube->getPoints();
    colors = myCube->getColors();

    glBufferSubData( GL_ARRAY_BUFFER, 0, sizeof(point4)*num_points, points );
    glBufferSubData( GL_ARRAY_BUFFER, sizeof(point4)*num_points, sizeof(color4)*num_points, colors );

    bool complete = myCube->checkComplete();

    for (i=0;i<3;i++){
        for (j=0;j<3;j++){
            for (k=0;k<3;k++){
                rot = myCube->getRotation(i,j,k);
                glUniformMatrix4fv( face_rotations, 1, GL_TRUE, rot);
                glDrawArrays( GL_TRIANGLES, offset_points, num_points/27 );
                offset_bytes += sizeof(point4) * num_points/27;
                offset_points += num_points/27;
            }
        }
    }
    if (complete){
        glutPrint(-0.55f, 0.65f, glutFonts[6], "Congratulations! The Cube is Complete", 0.0f, 0.0f, 0.0f, 1.0f);
    }

    glutPrint(-0.8f, -0.5f, glutFonts[5], "Directions", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.55f, glutFonts[5], "Rotate Face With Red Center: <a>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.60f, glutFonts[5], "Rotate Face With Yellow Center: <z>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.65f, glutFonts[5], "Rotate Face With Blue Center: <s>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.70f, glutFonts[5], "Rotate Face With White Center: <x>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.75f, glutFonts[5], "Rotate Face With Green Center: <d>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.80f, glutFonts[5], "Rotate Face With Orange Center: <c>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.85f, glutFonts[5], "Undo Last Move: <u>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.90f, glutFonts[5], "Save Cube: <w> followed by command line input", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.9f, -0.95f, glutFonts[5], "Exit Program: <esc>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.1f, -0.60f, glutFonts[5], "Note: Perform opposite rotation with <shift><rotation key>", 0.0f, 0.0f, 0.0f, 1.0f);
    glutPrint(-0.1f, -0.65f, glutFonts[5], "Rotate entire cube with left click and drag or arrow keys", 0.0f, 0.0f, 0.0f, 1.0f);

    glutSwapBuffers();
}
Пример #8
0
/* The main drawing function. */
void DrawGLScene(){

   glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
   glLoadIdentity();

   double RotationAngleX = 0.0;
   double RotationAngleY = 0.0;
   double RotationAngleZ = 0.0;

   if( dim3d==1 ) RotationAngleX = -60.0;
   if( dim3d==2 ) RotationAngleX = -90.0;
 
   glTranslatef( 0.0 , 0.0 , -CAM_BACKUP );

   glRotatef(RotationAngleX, 1, 0, 0);
   glRotatef(RotationAngleY, 0, 1, 0);
   glRotatef(RotationAngleZ, 0, 0, 1);

   int q = valq;

   getMaxMin();
   if( print_vals==0 ){
      printf("Max = %e Min = %e\n",maxval,minval);
      print_vals=1;
   }

   double camdist = 0.0;//-CAM_BACKUP;
   double xoff    = offx;
   double yoff    = offy;
   double zoff    = 0.0;

   if( draw_1d ){
      glColor3f(1.0,1.0,1.0);
      glBegin(GL_QUADS);
      glVertex3f(-1./rescale-xoff,-1./rescale-yoff, camdist + zoff );
      glVertex3f( 1./rescale-xoff,-1./rescale-yoff, camdist + zoff );
      glVertex3f( 1./rescale-xoff, 1./rescale-yoff, camdist + zoff );
      glVertex3f(-1./rescale-xoff, 1./rescale-yoff, camdist + zoff );
      glEnd();
      glLineWidth( 3.0f );
      glColor3f(0.0,0.0,0.0);
      glBegin( GL_LINE_STRIP );
      int j;
//      for( j=0 ; j<Nr ; ++j ){
      for( j=0 ; j<Nr ; ++j ){
         //if(logscale) val = log(getval(theZones[i],q))/log(10.);
         double rm = r_jph[j-1];
         double rp = r_jph[j]; 
         double val = theRadialData[j][q]/max_1d;//*pow(.5*(rp+rm),1.5);//2.*(theRadialData[j][q]-minval)/(maxval-minval) - 1.;//getval(theZones[i],q);
         if( q==1 ) val *= 1e2;
         val = 2.*val - 1.;
         double c0 = 2.*((.5*(rp+rm)-r_jph[-1])/(r_jph[Nr-1]-r_jph[-1]) - .5)/rescale;
         double c1 = val/rescale;
         glVertex3f( c0-xoff, c1-yoff, camdist-zoff+.001 );
      }    
      glEnd();
/*
      glColor3f(0.5,0.5,0.5);
      glBegin( GL_LINE_STRIP );

      for( j=0 ; j<Nr ; ++j ){
         //if(logscale) val = log(getval(theZones[i],q))/log(10.);
         double rm = r_jph[j-1];
         double rp = r_jph[j];
         double r = .5*(rp+rm); 
         double val = pow(r,-1.5)/max_1d;// *pow(.5*(rp+rm),1.5);//2.*(theRadialData[j][q]-minval)/(maxval-minval) - 1.;//getval(theZones[i],q);         if( q==1 ) val *= 1e2;
         val = 2.*val - 1.;
         double c0 = 2.*((.5*(rp+rm)-r_jph[-1])/(r_jph[Nr-1]-r_jph[-1]) - .5)/rescale;                 double c1 = val/rescale;
         glVertex3f( c0-xoff, c1-yoff, camdist-zoff+.001 );
      }       
      glEnd();
*/
      if( draw_planet ){
         double eps = 0.01;
         int p;
         for( p=0 ; p<Npl ; ++p ){
            double r   = thePlanets[p][0];
            double x = 2.*(( r - r_jph[-1] )/( r_jph[Nr-1]-r_jph[-1] ) - .5)/rescale;
            glColor3f(0.0,0.0,0.0);
            glLineWidth(2.0);
            glBegin(GL_LINE_LOOP);
            glVertex3f( x-xoff+eps , 1./rescale-yoff+eps , camdist+.001 );
            glVertex3f( x-xoff-eps , 1./rescale-yoff+eps , camdist+.001 );
            glVertex3f( x-xoff-eps , 1./rescale-yoff-eps , camdist+.001 );
            glVertex3f( x-xoff+eps , 1./rescale-yoff-eps , camdist+.001 );
            glEnd();
         }
      }

   }else{
      int Num_Draws = 1+reflect+draw_border;
      int count;
      int i,j;
      for( count = 0 ; count < Num_Draws ; ++count ){
         int draw_border_now = 0;
         int draw_reflected_now = 0;
         if( count==reflect+1 ) draw_border_now = 1;
         if( reflect && count==1 ) draw_reflected_now = 1;
         if( draw_border_now ) zoff -= .0001;
      for( j=0 ; j<Nr ; ++j ){
         double rm = r_jph[j-1]/rescale;
         double rp = r_jph[j]/rescale;
         double rc = .5*(rp+rm);
         double dr = rp-rm;
      
         if( !draw_border ){
            rm = rc-.55*dr;
            rp = rc+.55*dr;
         }
         for( i=0 ; i<Np[j] ; ++i ){

            double phip = p_iph[j][i];
            double phim;
            if( i==0 ) phim = p_iph[j][Np[j]-1]; else phim = p_iph[j][i-1];
            if( t_off && !p_off ){ phip -= t; phim -= t; }
            if( p_off ){ phip -= thePlanets[1][1]; phim -= thePlanets[1][1]; }
            double dp   = phip-phim;
            while( dp < 0.0 ) dp += 2.*M_PI;
            while( dp > 2.*M_PI ) dp -= 2.*M_PI;
            double phi = phim + 0.5*dp;
            if( !draw_border ){
               phip = phi+.55*dp;
               phim = phi-.55*dp;
            }

            double val = (getval(theZones[j][i],q)-minval)/(maxval-minval);
            if(logscale) val = (log(getval(theZones[j][i],q))/log(10.)-minval)/(maxval-minval);
            if( val > 1.0 ) val = 1.0;
            if( val < 0.0 ) val = 0.0;
            //double u = getval( theZones[j][i] , 2 );
            //if( uMax < u ) uMax = u;

            float rrr,ggg,bbb;
            get_rgb( val , &rrr , &ggg , &bbb , cmap );

            //if( (!dim3d || (sin(phi)>0 || cos(phi+.25)<0.0)) && dim3d !=2 ){
            if( dp < 1.5 && (!dim3d || (sin(phi)>0 && cos(phi)>0.0)) && dim3d !=2 ){
               if( !draw_border_now ){ 
                  glColor3f( rrr , ggg , bbb );
                  glBegin(GL_POLYGON);
               }else{
                  glLineWidth(3.0f);
                  glColor3f(0.0,0.0,0.0);
                  glBegin(GL_LINE_LOOP);
               }

               double z0 = 0.0;
               if( dim3d ) z0 = z_kph[Nz-1]/rescale;
     
               double c0 = rm*cos(phim);
               double c1 = rm*sin(phim);
               glVertex3f( c0-xoff, c1-yoff, camdist-zoff+z0 );

               c0 = rp*cos(phim);
               c1 = rp*sin(phim);
               glVertex3f( c0-xoff, c1-yoff, camdist-zoff+z0 );

               c0 = rp*cos(phi)/cos(.5*dp);
               c1 = rp*sin(phi)/cos(.5*dp);
               glVertex3f( c0-xoff, c1-yoff, camdist-zoff+z0 );

               c0 = rp*cos(phip);
               c1 = rp*sin(phip);
               glVertex3f( c0-xoff, c1-yoff, camdist-zoff+z0 );

               c0 = rm*cos(phip);
               c1 = rm*sin(phip);
               glVertex3f( c0-xoff, c1-yoff, camdist-zoff+z0 );

               glEnd();
            }
         }
         if( dim3d ){
            int k;
            for( k=0 ; k<Nz ; ++k ){
               int jk = j*Nz+k;
               double rp = r_jph[j]/rescale;
               double rm = r_jph[j-1]/rescale;
               double zp = z_kph[k]/rescale;
               double zm = z_kph[k-1]/rescale;

               double phi = 0.0;//rzZones[jk][Nq];

            double val = (getval(rzZones[jk],q)-minval)/(maxval-minval);
            if(logscale) val = (log(getval(rzZones[jk],q))/log(10.)-minval)/(maxval-minval);
            if( val > 1.0 ) val = 1.0;
            if( val < 0.0 ) val = 0.0;
            float rrr,ggg,bbb;
            get_rgb( val , &rrr , &ggg , &bbb , cmap );
               if( !draw_border_now ){ 
                  glColor3f( rrr , ggg , bbb );
                  glBegin(GL_POLYGON);
               }else{
                  glLineWidth(2.0f);
                  glColor3f(0.0,0.0,0.0);
                  glBegin(GL_LINE_LOOP);
               } 
                  
                  glVertex3f( rp*cos(phi) - xoff , rp*sin(phi) - yoff + zoff, zp );
                  glVertex3f( rm*cos(phi) - xoff , rm*sin(phi) - yoff + zoff, zp );
                  glVertex3f( rm*cos(phi) - xoff , rm*sin(phi) - yoff + zoff, zm );
                  glVertex3f( rp*cos(phi) - xoff , rp*sin(phi) - yoff + zoff, zm );
                  glEnd();
            }
            if( draw_border_now || dim3d == 1 ){
               glLineWidth(2.0f);
               glColor3f(0.0,0.0,0.0);
               glBegin(GL_LINE_LOOP);

               double rp = r_jph[Nr-1]/rescale;
               //double rm =-r_jph[Nr-1]/rescale;
               double rm = r_jph[-1]/rescale;
               double zp = z_kph[Nz-1]/rescale;
               double zm = z_kph[  -1]/rescale;

               glVertex3f( rp-xoff , -yoff+zoff , zp );
               glVertex3f( rm-xoff , -yoff+zoff , zp );
               glVertex3f( rm-xoff , -yoff+zoff , zm );
               glVertex3f( rp-xoff , -yoff+zoff , zm );
               glEnd();
            }
         }
      }
   }


   if( draw_bar ){
      double xb = 0.6;
      double hb = 1.0;
      double wb = 0.02;
      int Nb = 1000;
      double dy = hb/(double)Nb;
      int k;
      for( k=0 ; k<Nb ; ++k ){
         double y = (double)k*dy - .5*hb;
         double val = (double)k/(double)Nb;
         float rrr,ggg,bbb;
         get_rgb( val , &rrr , &ggg , &bbb , cmap );
         glLineWidth(0.0f);
         glColor3f( rrr , ggg , bbb );
         glBegin(GL_POLYGON);
         glVertex3f( xb    , y    , camdist + .001 ); 
         glVertex3f( xb+wb , y    , camdist + .001 ); 
         glVertex3f( xb+wb , y+dy , camdist + .001 ); 
         glVertex3f( xb    , y+dy , camdist + .001 ); 
         glEnd();
      }
      int Nv = 8;
      for( k=0 ; k<Nv ; ++k ){
         double y = (double)k*hb/(double)(Nv-1) - .5*hb;
         double val = (double)k/(double)(Nv-1)*(maxval-minval) + minval;
         char valname[256];
         sprintf(valname,"%+.2e",val);
         glLineWidth(1.0f);
         glColor3f(0.0,0.0,0.0);
         glBegin(GL_LINE_LOOP);
         glVertex3f( xb    , y , camdist + .0011 );
         glVertex3f( xb+wb , y , camdist + .0011 );
         glEnd();
         glutPrint( xb+1.5*wb , y-.007 , camdist + .001 ,glutFonts[6] , valname , 0.0f, 0.0f , 0.0f , 0.5f );
      }
   } 

   if( draw_planet ){
      double eps = 0.01;
      int p;
      for( p=0 ; p<Npl ; ++p ){
         double r   = thePlanets[p][0]/rescale;
         double phi = thePlanets[p][1];
         if( t_off && !p_off ) phi -= t;
         if( p_off ) phi -= thePlanets[1][1];
         glColor3f(0.0,0.0,0.0);
         glLineWidth(2.0);
         glBegin(GL_LINE_LOOP);
         glVertex3f( r*cos(phi)-xoff+eps , r*sin(phi)-yoff+eps , camdist+.001 );
         glVertex3f( r*cos(phi)-xoff-eps , r*sin(phi)-yoff+eps , camdist+.001 );
         glVertex3f( r*cos(phi)-xoff-eps , r*sin(phi)-yoff-eps , camdist+.001 );
         glVertex3f( r*cos(phi)-xoff+eps , r*sin(phi)-yoff-eps , camdist+.001 );
         glEnd();
      }
   }

   if( draw_spiral ){
      double rp   = 5.0;//thePlanets[1][0];
      double Mach = 3.65;
      double p0 = 1.2;
      double dr = .07;
      int Nr = 200;
      double Rmin = 0.5;
      double Rmax = 1.1;
      int k;
      glLineWidth(3.0f);
      glColor3f(0.0,0.0,0.0);
      //glColor3f(1.0,1.0,1.0);
      glBegin(GL_LINE_LOOP);
      for( k=0 ; k<Nr ; ++k ){
         //double phi0 = ((double)k+.5)/(double)Nr*2.*M_PI;//(3.-2.*sqrt(1./r)-r)*20.;
         double x = ((double)k+.5)/(double)Nr;
         //double r = .001*pow(.5/.001,x);
         double r = .5*pow(1.5/.5,x);
         //double phi0 = p0-log(r/0.001)*Mach;//(3.-2.*sqrt(1./r)-r)*5.;
         double phi0 = (3.-2.*sqrt(1./r)-r)*20.;
         if( r<1. ) phi0 = -phi0;
//         double x0 = rp + dr*cos(phi0);
//         double y0 = dr*sin(phi0);
  
         double phi = phi0;
//         double r = rp;       

//         double phi = atan2(y0,x0);
//         double phi = ((double)k+.5)/(double)Nr*2.*M_PI*9.32 + 4.*M_PI;
//         double r   = sqrt(x0*x0+y0*y0);
//         double r = pow(phi/10.,-2.);
//         double r   = 2./(1.+sin(phi));//1.0;//((double)k+0.5)/(double)Nr*(Rmax-Rmin) + Rmin;
//         if( r<1. ) phi = -phi;
         r /= rescale;
         
         glVertex3f( r*cos(phi)-xoff , r*sin(phi)-yoff , camdist + .0011 );
         if( k%2==1 ){
            glEnd();
            glBegin(GL_LINE_LOOP);
         }
      }
      glEnd();
/*
      e += 0.01;
      glBegin(GL_LINE_LOOP);
      for( k=0 ; k<Nr ; ++k ){
         double phi0 = ((double)k-.5)/(double)Nr*2.*M_PI;//(3.-2.*sqrt(1./r)-r)*20.;
         double x0 = 1.+e*cos(phi0);
         double y0 = e*sin(phi0);
         
         double phi = atan2(y0,x0);
         double r   = sqrt(x0*x0+y0*y0);
//         double phi = (double)k/(double)Nr*2.*M_PI;//(3.-2.*sqrt(1./r)-r)*20.;
//         double r   = 2./(1.+sin(phi));//1.0;//((double)k+0.5)/(double)Nr*(Rmax-Rmin) + Rmin;
//         if( r<1. ) phi = -phi;
         r /= rescale;
         
         glVertex3f( r*cos(phi)-xoff , r*sin(phi)-yoff , camdist + .0011 );
         if( k%2==1 ){
            glEnd();
            glBegin(GL_LINE_LOOP);
         }
      }
      glEnd();
*/
   }
   }

   if( draw_t ){
      char tprint[256];
      sprintf(tprint,"t = %.2e",t/2./M_PI);
      glutPrint( -.6 , .5 , camdist + .001 , glutFonts[6] , tprint , 0.0f, 0.0f , 0.0f , 0.5f );
  //    sprintf(tprint,"uMax = %.1f",uMax);
  //    glutPrint( -.8 , .4 , camdist + .001 , glutFonts[6] , tprint , 0.0f, 0.0f , 0.0f , 0.5f );
   }
   if( help_screen ){
      int NLines = 9;
      double dy = -.04;
      char help[NLines][256];
      sprintf(help[0],"Help Display:");
      sprintf(help[1],"b - Toggle Colorbar");
      sprintf(help[2],"c - Change Colormap");
      sprintf(help[3],"f - Toggle Max/Min Floors");
      sprintf(help[4],"p - Toggle Planet Data");
      sprintf(help[5],"1-9 - Choose Primitive Variable to Display");
      sprintf(help[6],"wasd - Move Camera");
      sprintf(help[7],"z/x - Zoom in/out");
      sprintf(help[8],"h - Toggle Help Screen");
      int i;
      for( i=0 ; i<NLines ; ++i ){
         glutPrint( -.8 , i*dy , camdist + .001 , glutFonts[6] , help[i] , 0.0f, 0.0f , 0.0f , 0.5f );
      }
   } 

   if( CommandMode ){
      TakeScreenshot("out.ppm");
      exit(1);
   }

   glutSwapBuffers();

}