NormalKeysDownkey = 1; but, im not aware of how many special keys there are, nore am i sure if they map out that way. Sorry if im too confusing, i have had a very long day. Thanks for your help in advance. GLUT hands you ascii key codes - there are 256 of these. An array of 256 bools will suffice; to test, use a single quote character: array.
- ASCII codes for the Enter key / Carriage Return (CR). ASCII codes for Enter / CR. CR decimal code: 13 10: CR hex code: 0D 16: CR binary code: 00001101 2: CR octal.
- As all operating systems deal with keyboard input differently, GLUT provides a simple set of functions to allow for cross-platform development. This tutorial is built upon the previous tutorial. GLUT recognizes 2 kinds of keys. Normal keys and special keys. The special keys can be represented with the prefix GLUTKEY. and are shown below.
- Line clipping algorithm code in c open gl glut (Cohen Sutherland) Date: February 1, 2020 Author: Harun-or-Rashid 0 Comments Here the boundary is defined as xmin=-200,xmax=200,ymin=-200 and ymax=200.
void glutKeyboardFunc(void (*func) (unsigned char key, int x, int y));
The GLUT_KEY_* are predefined constants in glut.h. The full set of constants is presented next:
Glut Key Codes
GLUT_KEY_F1 F1 function key
GLUT_KEY_F2 F2 function key
GLUT_KEY_F3 F3 function key
GLUT_KEY_F4 F4 function key
GLUT_KEY_F5 F5 function key
GLUT_KEY_F6 F6 function key
GLUT_KEY_F7 F7 function key
GLUT_KEY_F8 F8 function key
GLUT_KEY_F9 F9 function key
GLUT_KEY_F10 F10 function key
GLUT_KEY_F11 F11 function key
GLUT_KEY_F12 F12 function key
GLUT_KEY_LEFT Left function key
GLUT_KEY_RIGHT Right function key
GLUT_KEY_UP Up function key
GLUT_KEY_DOWN Down function key
GLUT_KEY_PAGE_UP Page Up function key
GLUT_KEY_PAGE_DOWN Page Down function key
GLUT_KEY_HOME Home function key
GLUT_KEY_END End function key
GLUT_KEY_INSERT Insert function key
Some sample OpenGL source code is provided here as additional and more complete examples of what is covered in the lectures. In most cases they are single files that you can compile with:
gcc simple.c -o simple -I/usr/X11R6/include/ -L/usr/X11R6/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU
Glut Keyboard Input
or on the Macintosh (OS X):
cc simple.c -o simple -framework GLUT -framework OpenGL -lobjc
(Substitute 'simple' for the program name).
Here is a Makefile to complie all the sample code for Linux (contributed by Brendon Taylor)
Glut Keyboard Codes Download
This program draws a white rectangle on a black background.
Illustates the use of GLUT to draw stroke and raster text. In addiditon shows how callbacks are used by GLUT to respond to redraw events, mouse clicks and keyboard events.
A simple example showing how to use display lists (Lecture7). Also shows how to use
Simple set of functions to illustrate the use of tessellation using GLU. Needed for viewports.c below.
Shows how to draw to multiple viewports. Requires the tessellation functions above.
|gasket.c||Draws the Sierpinski gasket using the random point method.|
Simple 3D program that draws glut shapes in wireframe mode. Use the right mouse button menu to select a new shape to draw.
Draws spiral patterns in 2D with simple parameter animation and mouse control. Press the space bar to display a menu of keyboard and mouse options. In particular try the 'a' and 'e' keys. Run in the background while you're programming to increase productivity.
|solar.tar.gz||Solar system model that demonstrates the use of compound transformations in OpenGL, also OpenGL lighting and depth buffering. This is a gzip'ed tar file – unpack the file and look at the README to see how to compile.|
|LoadObj.tgz||Program to load a model of an island and display it in using simple lighting. You can use this for assignment 2 if you can't get the fractal subdivision algorithm working.|