Robotics C++ Physics II AP Physics B Electronics Java Astronomy Other Courses Summer Session  

Some OpenGL Functions

glClearColor(red, green, blue, alpha);

Sets the current color.

 

alpha value

 

Opaque = 1

Transparent = 0

 

glBegin()  glEnd()

 

Encloses commands such as drawing of primitives (lines, etc).

 

glRotatef();

 

See other section 

 

glTranslatef();

 

See other section 

 

glScalef();

 

See other section 

 

glutPostRedisplay()

 

Marks the current window as needing to be redisplayed. The next iteration through glutMainLoop, the window's display will be called to redisplay the window.

 

If you don't tell the mainloop it needs to draw the next frame with a glutPostRedisplay then your animation will look as if it is stuck, even though the x,y,z position of the graphic will be changing.

 

glMatrixMode(GLenum mode);

 

Specifies whether the modelview, projection, or texture matrix will be modified. Subsequent commands affect the specified matrix.

 

glPushMatrix(void);

 

Pushes all matrices in the current stack down one level The current stack is determined by glMatrixMode().

 

glPopMatrix(void)

 

Pops the top matrix off the stack.

 

glutKeyboardFunc(char key, int x, int y);

 

Specifies the function that's called when a key that generates an ASCII character is pressed. The x and y parameters indicate the location of the mouse (in window-relative coordinates) when the key was pressed.

 

glLoadIdentify();

 

Used to initialize the current projection matrix so that only the specified projection transformatino has an effect.

 

glReshapeFunc(reshape);

 

Used to prevent distortions upon redrawing the window.  Usually contains glFrustum or glOrtho and the viewpoint (gluLookAt)

 

glDisplayFunc(display);

 

Calls the display function.

 

display()

 

Contains drawing and movement commands.

 

glutInit ();

 

Initializes GLUT and processes any command line arguments.

 

init();

 

Used for a variety of tasks - to initialize things. Typically includes calls to glClearColor() and glShadeModel();

 

glutInitWIndowPosition (int x, int y);

 

Specifies the screen location for the upper-left corner of your window.

 

glutInitWindowSize(int width, int height);

 

Specifies the size, in pixels, of your window.

 

intglutCreateWindow( char string);

 

Creates a window with an OpenGL context. Note that, until glutMainLoop() is called, the window will not be displayed.

 

glutMainLoop();

 

The last function that is called. All windows that have been created are now shown, and rendering to those windows is now effective. Event processing begins.

gluLookAt (eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)

Eye coordinates specified by eye, location of object specified by center, up position of camera specified by up