GLUT - F1 Key / function keys not captured by App - GLUT_KEY_F1

GLUT - F1 Key / function keys not captured by App - GLUT_KEY_F1

Post by Karthik Ku » Mon, 27 Sep 2004 08:34:20


Hi,
This question is not exactly about openGL, but about GLUT.
Sorry if this is O.T. to this newsgroup, in the first placee.

In my GLUT application, I wanted to capture the keyboard
shortcut 'F1' and process accordingly (to pop a help window).

The code fragment is given below -

// Key board Handler
void pointKeyFunc(unsigned char key, int x, int y) {
switch(key) {
case GLUT_KEY_F1:
help.show();
break;
// .. other keyboard events.
}
}

When I pressed F1, it didnt get into the case block for GLUT_KEY_F1.

In glut.h it is defined as follows -

#define GLUT_KEY_F1 1


I traced the program and when I pressed F1 it did not get
captured by the keyboard event handler.

What could I be missing here ?


--
Karthik.
 
 
 

GLUT - F1 Key / function keys not captured by App - GLUT_KEY_F1

Post by Paul Bourk » Mon, 27 Sep 2004 10:09:21

> void pointKeyFunc(unsigned char key, int x, int y) {

Did you register it with
glutKeyboardFunc();
or with
glutSpecialFunc();
You need to use the later.

----
Paul Bourke
pdb_NOSPAMswin.edu.au

 
 
 

GLUT - F1 Key / function keys not captured by App - GLUT_KEY_F1

Post by Karthik Ku » Mon, 27 Sep 2004 15:23:25


Oops !! I had used glutKeyboardFunc to register the callback.
Thanks for the clarification.


--
Karthik.
------------ And now a word from our sponsor ------------------
For a quality usenet news server, try DNEWS, easy to install,
fast, efficient and reliable. For home servers or carrier class
installations with millions of users it will allow you to grow!
---- See http://www.yqcomputer.com/