View Full Version : How to use DELETE key?

01-14-2005, 04:54 AM
How can I use the DELETE key in OpenGL?

GL_KEY_DELETE does not work
and 47 does not work for ASCII code?

Is it possible? A lot of people use this key I hear but I cant seem to code it in.... INSERT works.. but not DELETE

01-14-2005, 05:55 AM
OpenGL has absolutely nothing to do with the keyboard. You meant GLUT_ something.
Read a doc :

In your glutSpecialFunc callback, print the value of each keypress, run prog, hit delete, and use the value you see.

EDIT: Next time, please post to a more appropriate forum, like OpenGL toolkits (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=forum;f=10) .

01-14-2005, 06:46 AM
But there is no GLUT_KEY_DELETE

I still cant get the "delete" key to work

I've tried different ASCII codes it doesnt work!

01-14-2005, 11:18 AM
Does nobody have any ideas????

01-14-2005, 12:36 PM
Re-read the post of ZbuffeR, he already explained what to do.

01-15-2005, 10:33 AM
I dont know how to do what zbuffer said...

I cant print its value to the screen I cant code it...

Cant someone give me the values for insert and delete?

01-15-2005, 10:51 AM
I don't believe you can. Try glutKeyboardFunc.
Look here: http://pyopengl.sourceforge.net/documentation/manual/glutKeyboardFunc.3GLUT.xml

01-15-2005, 04:20 PM
That's because the ascii code for delete is 127!

void KInput(unsigned char key, int x, int y)
printf("%d\n", key);
if (key == 127) {
// do your thing
}Also be sure to register glutKeyboardFunc, not glutSpecialFunc.
Check google for glut's manual.