OpenGL and Vector Math Basics

CS 481 Lecture, Dr. Lawlor

C++ Libraries used with OpenGL

You can use many libraries along with OpenGL itself.  Here are a few we'll be using in this course:
Name
Description
Reference
Header
Windows
Linux
Mac OS X
OpenGL
Basic rendering calls: triangles, vertices, textures, etc.
The OpenGL FAQ is a good place to start, or the Manual Pages. The  OpenGL 1.4 Specification is unreadable legalese.  The Red Book is dated but readable.
<GL/gl.h>

(note captialization, Windows people!)
opengl32.lib

(Usually have to add this to your project's linker properties...)
libGL.so
-framework OpenGL
GLUT
Create windows, set up buffers, handle keyboard and mouse.
The original GLUT API document is readable.
<GL/glut.h>
glut32.lib or freeglut.lib
libglut.so
-framework GLUT
GLEW
Dynamic interface to latest OpenGL routines.  A must for programmable shaders on Windows!
GLEW makes new OpenGL extensions work as advertised.  The only pure-GLEW routine is glewInit().
<GL/glew.h>

(Include first; this replaces GL/gl.h!)
(I prefer it statically linked)


GLUI
Buttons, scrollbars, dropdown menus, and other widgets.
I've prepared some doxygen comments. There's also an older GLUI manual.
<GL/glui.h>
(I prefer it statically linked)

ogl
Orion's OpenGL utilities
Read the ogl/ header files.
"ogl/util.h",
"ogl/main.h",
...
(I prefer it statically linked)

physics
Orion's scene database
Read the physics/ header files.





Calls you Should Already Know

(or else calls you need to look up right now!)

Vectors, dot, and cross products

You should know basic 2D and 3D vectors, including dot products and cross products. Vectors are basically all we ever deal with in computer graphics, so it's important to understand these pretty well.

In particular, you should know at least:
You should pick one of the thousands of "vec3" classes on the web to represent vectors in your code, or else you'll go insane writing "glSomething3f(foo_x,foo_y,foo_z); foo_x+=bar_x; foo_y+=bar_y; foo_z+=bar_z;"

With a nice vec3 class, you'll be able to say "glSomething3fv(foo); foo+=bar;"