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 3 of 3

Thread: how to implement a continuous zoom with a mouse button hold...

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Knoxville
    Posts
    9

    how to implement a continuous zoom with a mouse button hold...

    Hello,

    I am attempting to implement a continuous zoom ability with the processMouse glut function. For example...

    void processMouse(int button, int state, int x, int y) {

    if (button == GLUT_LEFT_BUTTON) {

    zoom += .1f;

    }
    }


    This will work but requires my users to keep clicking the mouse button for each zoom increment. I have been unsuccessful implementing a continous zoom animation when my user presses and holds the mouse button. Any attempt usually results in an infinite zoom loop that can't be broken until the process is killed.

    Any help on this matter would be much appreciated.

    Thank You,
    jdaniel

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Mauritius
    Posts
    5

    Re: how to implement a continuous zoom with a mouse button hold...

    elo mate...maybe i can help you out. Just try it and let me know.

    just create an idle function
    void zoom(void)
    {
    z += .1;
    glutPostRedisplay();
    }

    Do not register any idle function in your main function but in your mouse function create conditions. For example
    if (button == GLUT_LEFT_BUTTON)
    glutIdleFunc(zoom);

    This should work.
    free thinkers are dangerous..

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Knoxville
    Posts
    9

    Re: how to implement a continuous zoom with a mouse button hold...

    yes your suggestion worked great. It is much appreciated, thanks.

Posting Permissions

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