I am trying to move the object inside my Qt QGLWidget. I want to be able to click on the screen anywhere inside the widget, move the mouse from one spot to another, and the object to move over exactly that amount. So if I click on the image at 1/4 * width and move the cursor to 2/4 * width, I want what appeared at 1/4width to now appear at 3/4width and everything else to move properly. This should result in part of the image now moving off the right side of the screen if it is wide enough.
I know how to capture my screen positions for where my mouse starts and moves to and finally stops. I am having problems trying to get the object to move as fast or slow as I move the mouse. I thought if I calculated the amount it moved over, say 100 pixels from left to right when the widget is say 700 pixels wide. So it moved 1/7 of the screen over to the right. I thought if I then said, my glOrtho() goes from -7 to 7 that I could just change my ortho to -5 to 9. Is this a correct assumption as to what would happen?
I am changing the ortho for zooming in on this object so I want to keep the things similar and would prefer to manually change the ortho for translations instead of calling glTranslate. Also, I need to always know the min and max values of my ortho, so it is easier for me to keep track of these if I always calculate them.
Does anyone have any idea of how to get my objects to move correctly so they keep up with the mouse? Thanks!