Lecture10-GamesOpenGL

Lecture10-GamesOpenGL - Writing Games in OpenGL CS 455...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Writing Games in OpenGL CS 455
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Outline The basic game loop. Registering for events. Simplifying physics models. Dealing with the matrix stack.
Background image of page 2
The Basic loop Update game state Redraw the display Post the new display Repeat
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Basic loop in GLUT // how to redraw the display glutDisplayFunc(display); // what to do when there's no events in a cycle. glutIdleFunc(physicsEngine); // where to send mouse button presses glutMouseFunc(mouse); // where to send mouse movement. glutPassiveMotionFunc (mouseMoved); // where to send keyboard events. glutKeyboardFunc (keyPress); glutReshapeFunc(reshape); glutMainLoop();
Background image of page 4
void keyPress (unsigned char key, int x, int y) { // print out the pressed key printf ("%c\n", key); // TODO: add an acceleration unit, turn the brakes // up and/or turn the handlebars // then do what you do on the rest of a cycle. physicsEngine ();
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/02/2012 for the course C S 455 taught by Professor Jones,m during the Winter '08 term at BYU.

Page1 / 16

Lecture10-GamesOpenGL - Writing Games in OpenGL CS 455...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online