home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 December / DPPCPRO1205.ISO / Essentials / Programming / Basic4GL / Setup Basic4GL v2.3.1.exe / $INSTDIR / Programs / nehe4.gb < prev    next >
Encoding:
Text File  |  2005-07-29  |  1.6 KB  |  30 lines

  1.     dim rtri#                                        ' Angle For The Triangle ( NEW )
  2.     dim rquad#                                        ' Angle For The Quad     ( NEW )
  3.     while true
  4.         glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)    ' Clear The Screen And The Depth Buffer
  5.         glLoadIdentity()                            ' Reset The View
  6.         glTranslatef(-1.5,0.0,-6.0)                    ' Move Left 1.5 Units And Into The Screen 6.0
  7.         glRotatef(rtri#,0.0,1.0,0.0)                    ' Rotate The Triangle On The Y axis ( NEW )
  8.         glBegin(GL_TRIANGLES)                            ' Drawing Using Triangles
  9.             glColor3f(1.0,0.0,0.0)                    ' Set The Color To Red
  10.             glVertex3f( 0.0, 1.0, 0.0)                    ' Top
  11.             glColor3f(0.0,1.0,0.0)                    ' Set The Color To Green
  12.             glVertex3f(-1.0,-1.0, 0.0)                    ' Bottom Left
  13.             glColor3f(0.0,0.0,1.0)                    ' Set The Color To Blue
  14.             glVertex3f( 1.0,-1.0, 0.0)                    ' Bottom Right
  15.         glEnd()                                    ' Finished Drawing The Triangle
  16.         glLoadIdentity()                            ' Reset the current modelview matrix
  17.         glTranslatef(1.5,0.0,-6.0)                        ' Move right 1.5 units and into the screen 6.0
  18.         glRotatef(rquad#,1.0,0.0,0.0)                    ' Rotate the quad on the X axis
  19.         glColor3f(0.5,0.5,1.0)                        ' Set the color to blue one time only
  20.         glBegin(GL_QUADS)                            ' Draw A Quad
  21.             glVertex3f(-1.0, 1.0, 0.0)                    ' Top Left
  22.             glVertex3f( 1.0, 1.0, 0.0)                    ' Top Right
  23.             glVertex3f( 1.0,-1.0, 0.0)                    ' Bottom Right
  24.             glVertex3f(-1.0,-1.0, 0.0)                    ' Bottom Left
  25.         glEnd()                                    ' Done Drawing The Quad
  26.         rtri# = rtri# + 0.2                            ' Increase The Rotation Variable For The Triangle ( NEW )
  27.         rquad# = rquad# + 0.15                        ' Decrease The Rotation Variable For The Quad     ( NEW )
  28.         SwapBuffers ()
  29.     wend
  30.