I am currently developing a 3D CAD application by using glOrtho. How can I create a zoom, with the typical CAD features? I mean, the zoom tool in which the user makes 1st click with the mouse + dynamic window indicating zoom extencion+2nd mouse click (this is the end of zoom).
Well, I’m not shure if this is the response you are looking for, but the actual “zooming” can be done with the glOrtho function, for example, if you first set your orthographic proyection to something like:
meaning that you have a coordinate system with the origin at screen’s left-bottom and the screen right most position is 800 and the top most is 600
and you select with the mouse a rectangle at left-top P0( 200,400 ) and right-bottom ( 600,200 ), then you can zoom your view by changing the orthographic view to:
p0.x, p1.x, // left, right
p1.y, p0.y, // bottom, top
-1.0f,1.0f // near, far
I solved the matter time ago. Actually it is required to do two things: glOrtho adjustment to the new captured window (i.e. the zoom window) and also to translate the coordinate system to the center of that box.