GLUT Basics
with Examples |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
glutDisplayFunc(void (*f)(void))
glutPostRedisplay()
glutReshapeFunc(void (*f) (int width, int height))
main()
]glutKeyboardFunc(void (*f)(unsigned char key, int x, int y))
int glutGetModifiers()
GLUT_ACTIVE_SHIFT
,
GLUT_ACTIVE_CTRL
, and
GLUT_ACTIVE_ALT
glutSpecialFunc(void (*f)(int key, int x, int y))
GLUT_KEY_F1
thru GLUT_KEY_F12
,
GLUT_KEY_LEFT
,
GLUT_KEY_RIGHT
,
GLUT_KEY_UP
,
GLUT_KEY_DOWN
,
GLUT_KEY_PAGE_UP
,
GLUT_KEY_PAGE_DOWN
,
GLUT_KEY_HOME
,
GLUT_KEY_END
, and
GLUT_KEY_INSERT
main()
]glutMouseFunc(void (*f)(int button, int state, int x, int y))
button
is either GLUT_LEFT_BUTTON
,
GLUT_MIDDLE_BUTTON
, or
GLUT_RIGHT_BUTTON
state
is either GLUT_UP
or
GLUT_DOWN
glutPassiveMotionFunc(void (*f)(int x, int y))
glutMotionFunc(void (*f)(int x, int y))
main()
]glutIdleFunc(void (*f) (void))
int glutCreateSubWindow(int parentWindow, int x, int y, int width, int height)
int glutDestroyWindow(int window)
glutDisplayFunc()
must be called for each
window (when it is "current")
void glutSetWindowTitle(char *name)
void glutSetCursor(int cursor)
cursor
is one of:
GLUT_CURSOR_INFO
, GLUT_CURSOR_HELP
,
GLUT_CURSOR_WAIT
, GLUT_CURSOR_TEXT
,
GLUT_CURSOR_CROSSHAIR
, GLUT_CURSOR_NONE
(or many others)
int glutCreateMenu(void (*callback)(int value))
void glutDestroyMenu(int menu)
void setMenu(int menu)
void glutAddSubMenu(char *name, int menu)
void glutAddMenuEntry(char *name, int valueToReturn)
void glutAttachMenu(int button)
void glutDetachMenu(int button)
button
is either
GLUT_LEFT_BUTTON
, GLUT_MIDDLE_BUTTON
, or
GLUT_RIGHT_BUTTON
main()
]