PDA

View Full Version : GLUT_KEY interferring with rest of keyboard



hkkho
11-15-2007, 08:09 AM
Below is the code for my keyboard functions. Currently if I want to move the object I am displaying I have to use CAP letters because if it is small case it interfers with the GLUT KEYS. What I am talking about is the numeric return for GLUT_KEY_PAGE_UP will be the same as small d (same ascii number)Is this a bug or is there a work around.
Thanks


call glutkeyboardFunc(keyboard)
call glutSpecialFunc(keyboard)



Subroutine keyboard(key,x1,y1)
use opengl_gl
use opengl_glu
use opengl_glut
Integer(4), intent(inout) :: key,x1,y1
selectcase (key)
case(GLUT_KEY_PAGE_UP)
z=z+30.0
case(GLUT_KEY_PAGE_DOWN)
z=z-30.0
case(GLUT_KEY_UP)
xrot=xrot-90.0
case(GLUT_KEY_DOWN)
xrot=xrot+90.0
case(GLUT_KEY_LEFT)
yrot=yrot+90.0
case(GLUT_KEY_RIGHT)
yrot=yrot-90.0
case(87)
y=y+100.1
case(83)
y=y-100.1
case(68)
x=x+100.1
case(65)
x=x-100.1
case default
end select
call glutPostRedisplay
return
endsubroutine keyboard

ZbuffeR
11-15-2007, 08:54 AM
Split your key handling, as described in the documentation :
http://www.opengl.org/resources/libraries/glut/spec3/node54.html


call glutkeyboardFunc(keyboard)
call glutSpecialFunc(keyboardSpecial)

Subroutine keyboardSpecial(key,x1,y1)
... function or directional keys ...

Subroutine keyboard(key,x1,y1)
... normal keys ...