Docsity

Understanding GLUT Library and Its Role in OpenGL Programming, Slides of Computer Graphics

Partial preview of the text

Download Understanding GLUT Library and Its Role in OpenGL Programming and more Slides Computer Graphics in PDF only on Docsity!

Computer

Graphics

Lecture 33

OpenGL

Programming

glut is platform independent. glut can:

 create window

 get keyboard input and

 run an event handler or

 message loop of application

Functions start with the

prefix “gl” are the core

OpenGL functions and

those start with “glu” or

“glut” are the OpenGL

utility library functions.

#include <GL/glut.h>

int main()

{

glutCreateWindow( "first graphics window" );

}

glutCreateWindow

creates a top-level

window.

String argument in the

window is used as

window name.

window's display state is not actually acted upon until glutMainLoop is entered.

This means until glutMainLoop is called, rendering to a created window is ineffective.

The int value returned is a unique identifier for the window.

identifiers starts from one, identifier can be used for calling glutSetWindow.

glutInitDisplayMode

glutInitDisplayMode sets the initial display mode.

void glutInitDisplayMode ( unsigned int mode);

Display mode, normally the bitwise OR -ing of GLUT display mode bit masks.

GLUT_RGB An alias for GLUT_RGBA.

GLUT_INDEX Bit mask to select a color index mode window. This overrides GLUT_RGBA.

GLUT_SINGLE Bit mask to select a single buffered window. This is the default.

GLUT_DOUBLE Bit mask to select a double buffered window. This overrides GLUT_SINGLE if it is also specified.

GLUT_DEPTH Bit mask to select a window with a depth buffer.

GLUT_STENCIL Bit mask to select a window with a stencil buffer.

GLUT_MULTISAMPLE Bit mask to select a window with multisampling support. If multisampling is not available, a non- multisampling window will automatically be chosen.