GLUT Keyboard

External: index
Internal: |- preamble -|- downloads -|- dependencies -|- building -|- end -|

Preamble

2011-03-09: I recently had an occasion to question the keyboard callback values from freeglut, and wrote, well copy and pasted together, this application just to show the value returned by the keyboard callbacks, both 'normal' and 'special'.

One known difference so far is Ctrl+Space. In WIN32, this continues to return a space, ' ', while in unix/linux/MAC it returns a zero, '\0'. Others have yet to be found.

Also it seems for later versions of freeglut compiled in WIN32, the 'special' keyboard is called back with the specific modifier keys themselves, on pressing Shift, Ctrl, Alt, ..., and during these particular callbacks, freeglut will output a warning if glutGetModifiers() is called ;=((

Why it was chosen to return these modifier keys them selves in WIN32 is unknown, since you only get the key down event, and not the key up, so they are useless for maintaining your own internal state. And it seems a little odd to output a warning like 'glutGetModifiers() called outside input callback', when this _IS_ strictly an 'input' callback ;=((

It seems to depend on the age of the freeglut_ext.h, as to whether these additional callbacks are defined, like say GLUT_KEY_SHIFT_L, so looks like a relative 'modern' inclusions...


top

Downloads

Take care downloading and running executables from the web!

Date Link Size MD5 Notes
2011/03/09 glutkbde01.zip 94,085 eaad1cd59bb3105dfaf9030667dfba0f WIN32 exe
2011/03/09 glutkbd-01.zip 211,368 e6bede5c082c166245b61e9d96525b60 Source
For a unix/linux, and hopefully MAX OS X builds, but is equivalent to the above
2011/03/09 glutkbd-1.0.0.tar.gz 102,079 979d4d94f0137bdc1dbb2b50c6ab4e02 Source

glutkbde01.zip - Contains just a WIN32 executable, glutkbd.exe.

glutkbd-01.zip - Contains the FULL source, in multiple folders.

glutkbd-1.0.0.tar.gz - Just an alternative source container.


top

Dependencies:

Needs freeglut, http://freeglut.sourceforge.net/, but perhaps can be built with other version of GLUT. I used the SVN development source checkout with -

svn co https://freeglut.svn.sourceforge.net/svnroot/freeglut/trunk/freeglut freeglut

I compiled just the static library, using the multi-threaded static runtime, /MT and /MTd, thus applications linking to these static libraries need to define FREEGLUT_STATIC, and FREEGLUT_LIB_PRAGMAS=0, before including freeglut_std.h/freeglut_ext.h.

Of course it is recommended that you likewise download the latest SVN source, but feel free to use my MSVC build files in the 'msvc' folder of the freeglut source zips below.

Date Link Size MD5 Notes
2011/03/09 freeglut-01.zip 432,174 1fc5ee19f06947d2dd0fb148b9df9918 Source
2011/03/06 freeglute01.zip 862,354 43a447cc573cd87129a3f0c3ca158d15 Binaries

The freeglute01.zip 'binaries' zip includes libfreeglut.lib, a static library, compiled with MS runtime /MT, and the demonstration executables. Note, not all example function as expected ;=(( freeglut-01.zip is the complete source used, but some other MSVC files and folders have now been deleted to avoid confusion.

Of course, there is also a dependency on Winmm.lib, OpenGL32.lib, Glu32.lib and Glaux.lib, which seems to usually already be installed in all versions of Windows, but sometimes they may come with the Windows SDK installation.

Actually the initial MSVC build files in my added 'msvc' folder, the MSVC6 DSW/DSP files, were generated using my perl script, amsrcs04.pl - see here. This script emulates some parts of the unix automake tool kit, in that is reads the configure.ac file, figures out the Makefile.am files used, reads them, and generates the various *.dsp files, and a final  <project>.dsw file. So these MSVC6 build files were the base of the converted MSVC8 sln/vcproj files.


top

Building

In WIN32

To build from the full source, unzip the glutkbd-01.zip to a folder of your choice, and load the glutkbd.sln in MSVC8 (2005) or later, correct the include and library path to where you built freeglut, or to possibly other version of GLUT, and build. This was in Windows XP, but should function in other later windows version, but not tried.

In Unix/Linux

Either unzip the glutkbd-01.zip, OR the glutkbd-1.0.0.tar.gz - they are equivalent. Then just run the 'makeme.sh'... Have only tested this in Ubuntu 8,04 LTS. Attempts have been made to automake 'find' the glut libraries in all ports - cygwin, mingw and apple-darwin - in configure.ac, but these have NOT been tested.


top

Have fun ;=))

EOP

checked by Tidy  Valid HTML 4.01 Transitional