Alternatives to GLUT or alternate input?

Member
Posts: 100
Joined: 2006.05
Post: #1
Ok, I ran into a little problem. The keyboard capabilities built into GLUT are, well, not very good. I used to use Carbon Events for my keyboard input, but since I use GLUT, I kinda don't see how I can use Carbon events at all (tried it too). Anyway, I know there's GetKeys() (If that's the right function) but I heard it is very quirky and unreliable. So, is there an alternate way of handling things whether it means not using GLUT or using some other keyboard method? If it's not too complicated I might be willing to set up OpenGL and handling it without GLUT (ie. working with Carbon and bare OpenGL).

Also, would I be able to use the HID Manager with GLUT? I heard it's a ***** to program for but I'd be willing to give it a go... Probably might end up doing that in the long run anyway....
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
What's wrong with GLUT's keyboard handling?

Yes, you could use the HID manager with GLUT, though you could probably only use the polling interface.
Quote this message in a reply
Member
Posts: 184
Joined: 2004.07
Post: #3
I used to use GLUT, but I've found that SDL is a good next step down in getting closer to the machine without crossing the platform-dependency border.
Quote this message in a reply
Member
Posts: 100
Joined: 2006.05
Post: #4
Well, actually the only keyboard functionality I know of is using the "glutKeyboardFunc( keyboard );" And that is based on the key-repeat rate so it's not very smooth... Is there another keyboard function in GLUT that I don't know about? Anyway, I really just need to poll the keyboard anyway at any given time (in the idle function that is).
Quote this message in a reply
Member
Posts: 156
Joined: 2002.11
Post: #5
I suggest you look at the source code at

http://webpages.charter.net/utopiaplanet...Struct.dmg

Then, create a struct with Booleans to map the current value of all keys you need, to later check if they are up or down. This is an example for the modifier keys:

Code:
void ProcessModKey( UInt32 keyMods )
{
    //----------------------------------------------------------------------

    if ( keyMods & cmdKey )
    {
    modKeyStatus.CommandDown = TRUE;
    }
    else
    {
    modKeyStatus.CommandDown = FALSE;
    }

    //----------------------------------------------------------------------
    
    if ( keyMods & shiftKey )
    {
    modKeyStatus.ShiftDown = TRUE;
    }
    else
    {
    modKeyStatus.ShiftDown = FALSE;
    }
// etc...
}
Quote this message in a reply
Member
Posts: 100
Joined: 2006.05
Post: #6
Joseph Duchesne just showed me that GLUT has a Keyboard Up routine... Now I know how to do it...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Alternate Back face culling Sohta 6 4,533 Aug 6, 2004 06:10 PM
Last Post: Sohta