1 / 10

CPSC 453 Tutorial

CPSC 453 Tutorial. Xin Liu Sep 24, 2013. freeglut. A variant of glut Two functions: Manage windows Interact with users Keyboard Mouse Joystick Not a necessary tool Useful for education. Initialization Functions. void glutInit ( int * argcp , char ** argv );

deiter
Download Presentation

CPSC 453 Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPSC 453 Tutorial Xin Liu Sep 24, 2013

  2. freeglut • A variant of glut • Two functions: • Manage windows • Interact with users • Keyboard • Mouse • Joystick • Not a necessary tool • Useful for education

  3. Initialization Functions • void glutInit(int *argcp, char **argv); • voidglutInitWindowPosition ( int x, int y ); • void glutInitWindowSize ( int width, int height ); • void glutInitDisplayMode(unsigned int mode);

  4. Event Processing Functions • void glutMainLoop ( void );

  5. Window Management • intglutCreateWindow(char *name); • intglutCreateSubWindow(intwin, intx, int y, int width, int height); • void glutSetWindow(int win); • intglutGetWindow(void); • void glutDestroyWindow(int win); • void glutSetWindowTitle(char *name); • void glutPositionWindow(int x, int y); • void glutReshapeWindow(int width, int height); • void glutFullScreen(void); • void glutLeaveFullScreen ( void );

  6. Display Functions • void glutSwapBuffers(void); • void glutPostRedisplay(void);

  7. Window Callback Registration • void glutDisplayFunc(void (*func)(void)); • void glutReshapeFunc(void (*func)(int width, int height)); • void glutPositionFunc ( void (* callback)( int x, int y) );

  8. Keyboard Callback Registration • void glutKeyboardFunc(void (*func)(unsigned char key, int x, int y)); • void glutKeyboardUpFunc ( void (*func) ( unsigned char key, int x, int y ) ); • void glutSpecialFunc(void (*func)(int key, int x, int y)); • GLUT_KEY_F1 F1 function key. • GLUT_KEY_F2 F2 function key. • GLUT_KEY_F12 F12 function key. • GLUT_KEY_LEFT Left directional key. • GLUT_KEY_UP Up directional key. • GLUT_KEY_RIGHT Right directional key. • GLUT_KEY_DOWN Down directional key. • GLUT_KEY_PAGE UP Page up directional key. • GLUT_KEY_PAGE DOWN Page down directional key. • GLUT_KEY_HOME Home directional key. • GLUT_KEY_END End directional key. • GLUT_KEY_INSERT Inset directional key. • void glutSpecialUpFunc ( void (*func) ( int key, int x, int y ) );

  9. Mouse Callback Registration • void glutMouseFunc(void (*func)(int button, int state, int x, int y)); • The button parameter is one of GLUT LEFT BUTTON, GLUT MIDDLE BUTTON, or GLUT RIGHT BUTTON. • The state parameter is either GLUT UP or GLUT DOWN • void glutMotionFunc(void (*func)(int x, int y)); • Mouse moves while one or more mouse buttons are pressed • void glutPassiveMotionFunc(void (*func)(int x, int y));

  10. Timer Callback Registration • void glutTimerFunc(unsigned intmsecs, void (*func)(int value), value);

More Related