Syllabus   Blank Homework   Quizzes  
Notes   Labs   Scores   Blank

Lecture Notes
Dr. Tong Lai Yu, 2010
    1. Introduction
    2. OpenGL Shading Language ( GLSL ) I
    3. GLSL II
    4. Curve and Surface Design
    5. Modeling Shapes with Polygonal Meshes
    6. Texture Mapping
    7. Casting Shadows
    8. Tools for Raster Display
    9. Parsing External Objects

    Introduction

    1. Computer Animation

      The art of creating moving images using computers.
      CGI -- Computer-generated imaging
      tweening ( morphing )


      Animated teapot.

      Example of Animation produced using motion capture techniques.

      Toy Story (1995) was the first fully computer-animated film


      Avatar Movie ( 2009 )
      The Technology Behind Avatar Movie
      ( Linux's silent but important role )
       
      2012 Movie ( 2009 )

    2. Shadows

    3. GLSL Images


      Fog effect created using glsl.
       
      GLSL dynamic lighting.
       

      Red hair created with texture-phong glsl shader.
       
      Image created with OpengGL and GLSL.

    4. Image Synthesis

      See

      http://graphics.stanford.edu/courses/cs348b-competition/ ( new window )

         

    5. Brief Review of OpenGL

      An API for making graphics:

    6. OpnenGL is an application programming interface ( API )
      a collection of routines that the programmer can call, along with a model of how the routines work together to produce graphics
      250 distinct commands ( about 200 core, 50 utility )  

    7. Device-independent graphics programming
      • produce nearly identical outputs in various hardware platforms
      • no user-input commands in core
      • no high-level commands for 3-D objects, one must build model from primitives -- points, lines, and polygons
      • OpenGL Utility Library ( GLU ) provides many modeling features,

        Note: GLUT (GL Utility Toolkit library) is not part of OpenGL.
        It makes life easier: do the windowing and IO stuff.

    8. Basics of OpenGL Code:

    9. Rendering -- the process by which a computer creates images from models.
    10. Models or objects are constructed from geometric primitives such as points, lines, polylines, polygons which are defined by one or more vertices.
    11. Functions calls between glBegin() and glEnd()
    12. Example -- drawing 3 points
      	glBegin( GL_POINTS );
      	  glVertex2i( 100, 40 );
      	  glVertex2i( 120, 50 );
      	  glVertex2i( 140, 80 );
      	glEnd();
      	
      glVertex2i(...)
      gl
      gl
      library  
      Vertex
      basic
      command  
      2
      number of
      arguments  
      i
      type of
      arguments  

    13. Data Types:
      Suffix    Data TypeCorresponding  
      C type
      OpenGL Type  
      Deinfition
      b8-bit Integersigned charGLbyte
      s16-bit IntegershortGLshort
      i32-bit Integerint or longGLint, GLsizei
      f32-bit Floating-pointfloatGLfloat, GLclampf
      d64-bit IntegerdoubleGLdouble, GLclampd
      ub8-bit Unsigned Integerunsigned charGLubyte, GLboolean
      us16-bit Unsigned Integerunsigned shortGLushort
      ui32-bit Unsigned Integer    unsigned int or
      unsigned long
      GLuint, GLenum, GLbitfield
        glVertex2i ( 7, 11 );
        glVertex2f ( 7.0, 11.0 );
        are the same

    14. Number of Arguments: 2, 3, 4

    15. Formats:
      • 'v' indicates vector format
      • absence of 'v' indicates scalar format
      • Example: glColor3f( 1.0, 0.0, 0.0 );

        GLfloat color_array[] = {1.0, 0.0, 0.0};
        glColor3fv( color_array );
    16. The Event Loop:

      OpenGL as a State Machine:

      Demo Programs: