PDA

View Full Version : orthographic zooming



vanitha
03-25-2006, 05:51 AM
Hi,

I am developing project in vc++ based on PCB designing using OpenGL Graphics. In my project, i am using orthographic projection. Please help me in developing the code for zoom in and zoom out & selected area zooming.

Tin Whisker
03-25-2006, 06:07 AM
Zooming is very simple. Just scale the parameters to a symmetric glOrtho projection -- scale them up to zoom out, scale them down to zoom in.

vanitha
03-25-2006, 06:52 AM
can you send me some example code please.

Tin Whisker
03-25-2006, 07:01 AM
There's nothing to it, really. Just call glOrtho on the top of the projection matrix stack.

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(left*zoom, right*zoom, bottom*zoom, top*zoom, near, far);

Tin Whisker
03-25-2006, 07:27 AM
Vanitha, did you need help with something other than just the projection matrix? I'm afraid I don't know where to begin or end with such an open-ended question. I don't want to reinvent the wheel here (I'm sure a similar question has come up before).

Ehsan Kamrani
03-25-2006, 09:07 AM
Here you can find some information about the camera:
http://www.opengl.org/resources/faq/technical/viewing.htm
More important, see this FAQ:
8.040 How do I implement a zoom operation? in the above link.

-Ehsan-