| 
                  OpenGL Basics
                   with Examples  | 
            
| 
                   
                      
                     Prof. David Bernstein
                       | 
            
| Computer Science Department | 
| bernstdh@jmu.edu | 
               
            
         
            
         
         
            
         GLbyte, GLshort, GLint
                     GLfloat, GLdouble
	                    void glEnable(GLenum) and 
              void glDisable(GLenum) functions
        GLboolean glIsEnabled(GLenum)
                     void glGetBooleanv(GLenum, GLboolean*),
              void glGetIntegerv(GLenum, GLint*),
              void glGetFloatv(GLenum, GLfloat*), and
              void glGetDoublev(GLenum, GLdouble*)
                     
         
            
         glClearColor(r, g, b, alpha)
                     glClearDepth(depth)
                     glClear(bitflags)
                     GL_COLOR_BUFFER_BIT and
              GL_DEPTH_BUFFER_BIT
                     
         
            
         void glVertex2s(GLshort, GLshort), 
              void glVertex3s(GLshort, GLshort, GLshort), 
              void glVertex4s(GLshort, GLshort, GLshort, GLshort)
                     void glVertex2i(GLint, GLint), 
              void glVertex3i(GLint, GLint, GLint), 
              void glVertex4i(GLint, GLint, GLint, GLint)
                     void glVertex2f(GLfloat, GLfloat), 
              void glVertex3f(GLfloat, GLfloat, GLfloat), 
              void glVertex4f(GLfloat, GLfloat, GLfloat, GLfloat)
                     void glVertex2d(GLdouble, GLdouble), 
              void glVertex3d(GLdouble, GLdouble, GLdouble), 
              void glVertex4d(GLdouble, GLdouble, GLdouble, GLdouble)
                     glVertex*()
	                    
         
            
         glColor*()
                     glIndex*()
                     glSecondaryColor*()
                     glNormal*()
                     glMaterial*()
                     
         
            
         GL_POINTS, GL_LINES,
              GL_TRIANGLES, GL_QUADS,
              GL_POLYGON
                     void glBegin(GLenum)
                     void glEnd()
	                    
         
            
         
         
            
         void glPointSize(GLfloat)
	                    void glLineWidth(GLfloat)
	                    void glPolygonMode(GLenum face, GLenum mode)
	                    face is either GL_FRONT
              or GL_BACK
                     mode is either GL_FILL
              or GL_LINE
                     
         
            
         
         
            
         void glEnableClientState(GLenum)
              passing GL_VERTEX_ARRAY, 
	      GL_COLOR_ARRAY, GL_NORMAL_ARRAY
              or another acceptable value
	
         
            
         void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
	                    void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
	                    void glNormalPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
	                    
         
            
         void glArrayElement(GLint) or
              void glDrawElements(GLenum mode, GLsizei count, GLenum type, void* indices)
	                    
         
            
         
void glDrawElements(GLenum mode, GLsizei count, GLenum type, void* indices)
               
         
            
         
         
            
         void glMatrixMode(GLenum mode)
                  mode can be GL_MODELVIEW,
              GL_PROJECTION, or GL_TEXTURE
	                    void glLoadIdentity()
                  void glLoadMatrix*(const type* m)
                  m
                     
         
            
         gluLookAt()
	                    glTranslate*(), 
              glScale*(), glRotate*()
	                    
         
            
         glOrtho(left, right, bottom, top, near, far)
	                    glFrustum(left, right, bottom, top, near, far)
	                    gluPerspective(fovy, aspect, near, far)
	                    fovy is the field of view (in degrees)
              in the \(y\) direction, aspect is
              the aspect ration that determines the FOV in the
              \(x\) direction, near is the positive 
              distance from the viewer to the near clipping plane, and 
	      far is the positive 
              distance from the viewer to the far clipping plane