PDA

View Full Version : how i can use the mouse for move the screen?



oscar leo
09-12-2011, 08:24 PM
hi i have a question. what i have to use to move the view of the application, the glViewport statement or the glTranslatef, what use?.

i'm working in one application in C++ with Win32 and python with wxpython to test the openGL libraries and how they work. now i want move mouse to move the view (no rotate) move to x y or z if the view is rotated how i can do that?

or create a camera and work whit it.
in nehe i can't find nothing that helps

BionicBytes
09-13-2011, 10:17 AM
Your having a laugh, right?
Of course HeNE can help, as it implements a complete camera class which will do exactly what you need and more.
You need to read the tutorials a little more fully and try to understand what is happening with the ModelView matrix as this is the key to what you see on the screen.

DarthPJB
09-25-2011, 12:01 PM
HeNE

The poor chap is obviously neither a native English speaker or an experienced programmer:

Further NeHe's python classes are somewhat limited from what I remember (unless someone has updated them of late.)


what i have to use to move the view of the application, the glViewport statement or the glTranslatef, what use?.

glViewport only changes the size of the area you draw to. Do not want.
glTranslate / glRotate move objects around inside the 'world'.
The camera does not move, you must move the world around the camera.
This may sound (and is) backwards to what you would expect, but makes sense for the computer.

Consider:
LoadIdentity

Person moves mouse: GlTranslate / glrotate to move the world around the camera (making it look like the camera moved).
glPushMatrix
Move objects around with glTranslate / glrotate
glPopMatrix

SwapBuffers


or create a camera and work whit it.
It is best when you begin to imagine there is only one camera. This camera does not move, rather you move everything else around it.
While this is not (strictly) true, it makes it simpler to understand how you 'move the camera'.