Introduction to openGL
OpenGL is an API. OpenGL is nothing more than a set of functions you call from
your program (think of as collection of .h file(s)).
OpenGL Libraries
OpenGL
Application
GLU
GL
GLUT
GLX
Frame Buffer
Display
OpenGL Hierarchy:
Several levels of abstraction are provided
GL
Lowest level: vertex, matrix manipulation
glVertex3f(point.x, point.y, point.z)
GLU
Helper functions for shapes, transformations
gluPerspective( fovy, aspect, near, far )
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
GLUT
Highest level: Window and interface management
glutSwapBuffers()
glutInitWindowSize (500, 500);
OpenGL Implementations:
OpenGL IS an API (think of as collection of .h files):
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
Windows, Linux, UNIX, etc. all provide a platform specific
implementation.
Windows: [Link] [Link] [Link]
Linux: -l GL -l GLU l GLUT
Event Loop:
OpenGL programs often run in an event loop:
Start the program
Run some initialization code
Run an infinite loop and wait for events such as
Key press
Mouse move, click
Reshape window
Expose event
OpenGL Command Syntax (1) :
OpenGL commands start with gl
OpenGL constants start with GL_
Some commands end in a number and one, two or three letters at the
end (indicating number and type of arguments)
A Number indicates number of arguments
Characters indicate type of argument
OpenGL Command Syntax (2)
`f' float
`d' double float
`s' signed short integer
`i' signed integer
`b' character
`ub' unsigned character
`us' unsigned short integer
`ui' unsigned integer