Results 1 to 3 of 3

Thread: Synthetic vision: Using mouse input

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2011

    Synthetic vision: Using mouse input

    I am doing a project on synthetic vision system in windows..In which 3d map of the room will be already created using the opengl. A remote controlled car is actually kept in the room. And as the car moves ahead, the map should also be moved according to the car movement. For detecting the movement of the car i am using a bluetooth mouse attatched to the car. So my problem is now that as i move the mouse, the "virtual camera" should move accordingly in the opengl. For that i am using glpassivemotion() function. But the problem is that on the screen the mouse stops at the bounds and further motion outside the bound is not detected as the mouse pointer gets stuck at the end( last pixel) of the screen. How can i solve this problem. Is there any other alternative for mouse?

  2. #2
    Newbie Frequent Contributor
    Join Date
    Mar 2016

    Re: Synthetic vision: Using mouse input

    You can use glutWarpPointer to move the cursor to the center (provided you have a glut implementation that has that function, freeglut does for example).
    Also see this thread.

  3. #3
    Member Contributor
    Join Date
    Feb 2011

    Re: Synthetic vision: Using mouse input

    you are very lucky and i have my controls file open
    this code should give you enuf info
    note that the mouse never leaves the center with this cool trick

    /* MOUSE */
    glutWarpPointer(mid_x, mid_y);


    glutPassiveMotionFunc(mouseMove); //check for mouse movement

    void mouseMove(int x, int y) {

    // If our cursor is still in the middle, we never moved... so don't update the screen
    if( (x == mid_x) && (y == mid_y) ) return;

    // Set the mouse position to the middle of our window
    glutWarpPointer(mid_x, mid_y);

    float angle_y = 0.0f;
    float angle_x = 0.0f;

    /* LEFT & RIGHT */
    angle_y = (float)(mid_x - x) / MOUSE_SPEED;
    angle.y = angle_y;

    /* UP & DOWN */
    angle_x = (float)(mid_y - y) / MOUSE_SPEED * 2;
    angle.x = angle_x;

    mView.z -= angle_x * 90;

    //if ((mView.y - mPos.y) > n) mView.y = mPos.y + n;
    //if ((mView.y - mPos.y) < -n) mView.y = mPos.y - n;

    //debug = -angle_y;


    mouse_x = x;
    mouse_y = y;


Similar Threads

  1. synthetic vision:
    By mdj1342 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-29-2012, 10:06 AM
  2. more than one mouse input
    By Unition in forum OpenGL: Windows
    Replies: 5
    Last Post: 04-09-2005, 02:18 AM
  3. mouse speed between sampled mouse input points
    By sunnymonk in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-06-2005, 09:43 AM
  4. Mouse Input
    By Alex Derby in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-24-2002, 12:37 PM
  5. Do 3D input with the mouse?
    By Peter in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 07-09-2000, 04:55 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