Download presentation
Presentation is loading. Please wait.
Published byKory Barrett Modified over 9 years ago
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.