Results 1 to 7 of 7

Thread: about glut keyboard routine

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005
    Location
    turkey
    Posts
    10

    about glut keyboard routine

    Can anyone tell me how can we press 2 keys at the same time using glut. I have some code that we can press without glut. But I want to do that with glut.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Aug 2004
    Location
    Angers, France
    Posts
    245

    Re: about glut keyboard routine

    I should check the documentation about GLUT
    Nate\'s homepage

    The Redbook 1.2 speak about GLUT i think, there is an online version of the book here
    The .Product will make you .Believe

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2005
    Location
    turkey
    Posts
    10

    Re: about glut keyboard routine

    I have checked there but, it explains only routines. I have read some part of the red book.
    It also uses examples with glut but i can't press 2 keys at the same time. Can glut achieve this or not... any ideas?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Aug 2003
    Posts
    369

    Re: about glut keyboard routine

    Well it depends on which two keys. If you want a usual combination like Alt+K for example, there's glutGetModifiers() I think, which returns something like GLUT_CTRL, GLUT_ALT etc. Check it out.
    Another idea, would be to have a timer that checks the time between the 2 keypresses. If it is under a certain threshhold then, you can say that they're pressed together.
    I read it in another post today here and I guess I need to re-iterate: glut is used to help someone learn OpenGL (well, and then some) but if you want to do really serious stuff you should go with the OS's windowing system. Good luck!

  5. #5
    Junior Member Newbie
    Join Date
    May 2004
    Location
    France
    Posts
    7

    Re: about glut keyboard routine

    Go here http://www.lighthouse3d.com/opengl/glut/index.php?7
    maybe it will help you.
    And read the glut.h file. It is easy to understand.

  6. #6
    Junior Member Newbie
    Join Date
    Feb 2005
    Location
    turkey
    Posts
    10

    Re: about glut keyboard routine

    Well i don't want a combination like alt+K. A timer threshold is not useful for me because i will implement a kind of game. For example you will go forward when pressing 'w' key and you will be able to turn at the same time when you press 'a' key. I think moucard is right.I should go with the OS's windowing system. I just wanted to use glut because opengl is a little bit easier
    when you use glut library. Code is easier to understand.
    thank you

  7. #7
    Senior Member Regular Contributor
    Join Date
    Aug 2003
    Posts
    369

    Re: about glut keyboard routine

    Naah don't worry, after a few weeks in an API you'll start feeling comfortable with it. God knows DirectX can look ugly but after a while you get used to names like PFNKEYBOARDCALLBACK etc.

Similar Threads

  1. using GLUT and calling an infinite loop routine won't work ?
    By bilsch01 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-20-2015, 08:20 AM
  2. Something about glut keyboard input
    By Totti in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-14-2007, 08:59 AM
  3. Keyboard and GLUT
    By Hec in forum OpenGL: General
    Replies: 2
    Last Post: 06-11-2002, 02:37 PM
  4. Keyboard Input in GLUT
    By Vadood in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-12-2001, 03:11 PM
  5. glut and keyboard
    By Eber Kain in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 07-06-2001, 11:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean