OpenGL C Quick Reference

GLvoid glClear( GLbitfield mask ) 

Paints the current window with the current clear color. The four values that can be bitwise ORed into mask are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT.


GLvoid glClearColor( GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha )

Sets the current clear color.


GLvoid glFinish( GLvoid ) 

Forces all pending operations to complete.


GLvoid glFlush( GLvoid )

Forces all pending operations to begin.


GLenum glGetError( GLvoid ) 

Returns a constant identifying one error at a time.


const GLubyte* gluErrorString( GLenum errorCode )

Returns an error message string for the specified OpenGL or GLU error code.


int glutCreateWindow( char *title )

Returns a unique identifier for the new window title is displayed in the window's title bar


void glutDisplayFunc( void (*func)(void) ) 

Sets up a callback function to update the contents of the window for the current window.


int glutGet( GLenum state )

Retrieves GLUT state information. For a full list of the state constants, see the GLUT specification.


int glutInit( int *argcp, char **argv )

Initializes the GLUT library and negotiates a session with the window system.


void glutInitWindowSize( int width, int height ) 

Sets window width and height in pixels, not including borders.


void glutInitWindowPosition( int x, int y ) 

Sets window position in pixels relative to the upper-left corner of the screen.


void glutInitDisplayMode( GLenum mode )

Specifies the type of window to create. mode is a bitwise-OR of bitmasks.


void glutMainLoop( GLvoid ) 

An infinite loop that invokes callbacks, as necessary. Must be last function in main().


void glutKeyboardFunc( void (*func)(unsigned char key, int
 x, int y) )

Sets up a keyboard callback function for the current window, to be invoked when an ASCII key is pressed.


void glutSpecialFunc( void(*func)(int key, int x, int y) )

Sets up a special key callback for the current window. key is a GLUT_KEY_* constant indicating which key was pressed.


void glutPostRedisplay( void )

Marks the current window as needing to be redisplayed.