Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glutTimerFunc & double clicking

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2003
    Posts
    6

    glutTimerFunc & double clicking

    Hi.

    1. I have a question about glutTimerFunc.

    2. I want to use it to determine if a user has registered a double click or not.

    3. I've set that 2 milliseconds should the max time between clicks for it to be registered as a double click.

    4. How do I find out if the second click has been registered within 2 milliseconds?

    Thank you.
    Raja

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2003
    Location
    Toulouse, France
    Posts
    133

    Re: glutTimerFunc & double clicking

    on the first click, call glutTimerFunc and set a boolean variable (waiting_for_another_click) to true.
    on the second click, if waiting_for_another_click==true then that were a double click.
    obviously, you have to reset waiting_for_another_click to false when the timer func is called.

    2 milliseconds is very short. try 250 milliseconds instead.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2003
    Posts
    6

    Re: glutTimerFunc & double clicking

    Hi.

    1. Thanks for the reply.

    2. I have initialiaed glutTimerFunc() in the main function, is that ok?

    3. What should be the value of *value* in

    "glutTimerFunc(unsigned int msecs, void (*func)(int value), value); "

    Thanks.
    Raja

  4. #4
    Junior Member Regular Contributor
    Join Date
    Apr 2003
    Location
    Toulouse, France
    Posts
    133

    Re: glutTimerFunc & double clicking

    hi.
    you have to call glutTimerFunc each time you want to check a double click, not just in the main function

    the value parameter is passed to the callback at the end of msecs milliseconds.
    using this value, you are able to define mutliple timer which use the same function but according to value, perform different operations.

    you should take a look at: http://www.opengl.org/developers/doc...ec3/spec3.html
    for glut version 3 specification

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •