home *** CD-ROM | disk | FTP | other *** search
/ 3DS Max Model 2 / 3dsModelCD2.iso / ALTEROS / PLUGINS / GLC.X3D / CPP / APP_DRAW < prev    next >
Encoding:
Text File  |  2001-02-02  |  1.2 KB  |  43 lines

  1. /*
  2.  *  DrawScene uses OpenGL commands to draw a object.
  3.  *
  4.  *  Input parameters:
  5.  *    hdc = Device context handle
  6.  *    nAngle = Angle of rotation for object
  7.  *
  8.  *  Returns:
  9.  *    Nothing
  10.  */
  11.  
  12. void DrawScene (HDC hdc, UINT nAngle,UINT nAngle2)
  13. {
  14.         sizex=glnWidth;
  15.         sizey=glnHeight;
  16.  
  17.         gldAspect = (GLdouble) glnWidth / (GLdouble) glnHeight;
  18.  
  19.         glMatrixMode (GL_PROJECTION);
  20.         glLoadIdentity ();
  21.         gluPerspective (30.0,           // Field-of-view angle
  22.                         gldAspect,      // Aspect ratio of viewing volume
  23.                         1.0,            // Distance to near clipping plane
  24.                         10.0);          // Distance to far clipping plane
  25.  
  26.         glViewport (0, 0, glnWidth, glnHeight);
  27.     //
  28.     // Clear the color and depth buffers.
  29.     //
  30.     glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  31.  
  32.     //
  33.     // Define the modelview transformation.
  34.     //
  35.     glMatrixMode (GL_MODELVIEW);
  36.     glLoadIdentity ();
  37.     glTranslatef (0.0f, 0.0f, -8.0f);
  38.     glRotatef (30.0f, 1.0f, 0.0f, 0.0f);
  39.     glRotatef ((GLfloat) nAngle, 0.0f, 1.0f, 0.0f);
  40.     glRotatef ((GLfloat) nAngle2, 1.0f, 0.0f, 0.0f);
  41.     glScalef (nSize+2.5f,nSize+2.5f,nSize+2.5f);  
  42.  
  43.