Results 1 to 4 of 4

Thread: How can i pan the model with my mouse in 3d

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2004
    Posts
    6

    How can i pan the model with my mouse in 3d

    In my project,the model is imported from a 3ds file and cosists of several indepent parts.Now i can select the different parts individualy by the mouse.But how can i pan them individualy by the mouse.

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2004
    Posts
    6

    Re: How can i pan the model with my mouse in 3d

    btw,usually i resolve that problem as follow:
    glMatrixMode(GL_PROJECTION)
    glPushMatrix();
    glLoadIdentity();
    glOrtho(0,widow_width,0,widow_height);

    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    glViewport(0,0,widow_width,widow_height);

    glTranslatef(mouse.x,mouse.y,0.0);

    drawmodel();
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION)
    glPopMatrix();

    but the problem is the coordinats of my model
    is too small to show them under this condition.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2004
    Posts
    6

    Re: How can i pan the model with my mouse in 3d

    oh,sorry,there is an error in this command:
    glTranslatef(mouse.x,mouse.y,0.0);
    should be:
    glTranslatef(mouse.x,widow_height-mouse.y,0.0);

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    806

    Re: How can i pan the model with my mouse in 3d

    Moving this to the beginner's forum. If I understand your question correctly, all you need to do is divide your mouse offsets by some factor that places them more in line with the coordinates of your model.

    -- Tom

Similar Threads

  1. obj model loader & mouse picking example
    By gafferuk in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-03-2009, 08:37 PM
  2. Track Mouse Position & Rotate Model To Angle?
    By imported_ajm113 in forum OpenGL: General
    Replies: 6
    Last Post: 11-17-2008, 08:18 PM
  3. 3D Model Rotation abt Screen Coords based on mouse movement
    By dan81 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-11-2005, 06:43 AM
  4. How can i pan the model with my mouse in 3d
    By seadreamer in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 08-23-2004, 06:56 AM
  5. Rotation of model by dragging mouse
    By WT in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-21-2001, 03:45 AM

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