Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 450: COMPUTER GRAPHICS REVIEW: GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE.

Similar presentations


Presentation on theme: "CS 450: COMPUTER GRAPHICS REVIEW: GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE."— Presentation transcript:

1 CS 450: COMPUTER GRAPHICS REVIEW: GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE

2 MOUSE COORDINATES: UP IS DOWN All mouse coordinates in GLUT are in SCREEN COORDINATES with Y INVERTED (so up is down) Relative to TOP-LEFT window corner! If storing, do something like this: currentYMouse = windowHeight – yMouse;

3 MOUSE glutMouseFunc(); Mouse button is FIRST PRESSED or RELEASED Mouse click = two events (a press and release) glutMotionFunc(); Mouse MOVING and ANY mouse button is down glutPassiveMotionFunc(); Mouse MOVING and NO mouse buttons are down

4 KEYBOARD glutKeyboardFunc() Regular keys (ASCII code) When the user PRESSES a key  continues calling as long as key is down glutSpecialFunc(specialKeyboard) Special keys (F1, arrow keys, etc.)  uses GLUT constants

5 POPUP MENUS GLuint menuID = glutCreateMenu(menuFunction) void menuFunction(GLint menuItemNumber) Called when a menu item is clicked on GLint menuItemNumber = index of menu item In function, decide what to do for each menu item glutAddMenuEntry(charString, menuItemNumber) Add menu item  string with item number glutAttachMenu(button) Determine which mouse button opens menu glutAddSubMenu(submenu) Add another menu as submenu of current menu


Download ppt "CS 450: COMPUTER GRAPHICS REVIEW: GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE."

Similar presentations


Ads by Google