Results 1 to 3 of 3

Thread: Problem with pan!

  1. #1
    Member Contributor
    Join Date
    Oct 2011
    Posts
    72

    Problem with pan!

    Hi guys,

    Iím trying to pan in an ortho projection using a camera located perpendicular to the plane. I calculate the distance between the last position of the mouse and the new one every time the mouse is moving and I shift the camera to this delta distance.

    It works but I want the scene be synchronized with the mouse pointer in that way they move together keeping the objects in the scene at the same distance to the mouse cursor where they were located when the panning started. But itís not like that; the objects in the scene are shifted a little more than the mouse cursor.

    If I multiply this delta distance by a factor say 0.004 it works better but Iím still having the problem. Can someone explain me how can I calculate this factor and why itís needed?

    Thanks,

    PD: I unproject the mouse coordinates before calculate the delta distance.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    408

    Re: Problem with pan!

    That is a difficult question to answer directly. I don't have the answer you ask for.

    However, there is a library at GltZPR - Zoom, Pan, Rotate that might help you get started. I would try compiling it and running it. Then take a look at the code -- it is a single C file. This may help to see how someone else accomplished something similar to what you ask.

  3. #3
    Member Contributor
    Join Date
    Oct 2011
    Posts
    72

    Re: Problem with pan!

    Hi Marshats again!

    I found the solution yesterday in the night. This factor is the amount of OpenGL pixels that appear in the viewport divided by the amount of window's pixels.

    Thank you very much once again!

Similar Threads

  1. Replies: 1
    Last Post: 09-23-2016, 02:24 PM
  2. Shading problem? (pyglet-problem?, my problem?)
    By H2OBrain in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-03-2009, 08:31 AM
  3. Replies: 4
    Last Post: 09-27-2004, 06:27 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