Hi everyone,

I want to zoom in on a 2D drawing in OpenGL and so I modify the
clipping area when a button is pressed. The zoom algorithm is very
simple:

float initialWidth=Math.abs(screenArea.maxX-screenArea.minX);
screenArea.minY += zoomSize;
screenArea.maxY -= zoomSize;
float zoomedWidth=Math.abs(screenArea.maxY-screenArea.minY)
*aspectRatio;
screenArea.minX += (initialWidth-zoomedWidth)/2;
screenArea.maxX -= (initialWidth-zoomedWidth)/2;

gl.glOrthof(screenArea.minX, screenArea.maxX,screenArea.minY,
screenArea.maxY, 1, -1);

This goes very well up to a certain point, where
screenArea.minX = 3096.8154f;
screenArea.maxX = 3152.815f;
screenArea.minY = 5648.5005f;
screenArea.maxY = 5723.7495f;

>From here on, there is no more zooming, but the whole image pans out
on the Y axis (the pan is exponential: at the first click it moves a
little, at the second click more, etc).

PS: If I substract from every X coordonate in the scene minX and from
every Y coordonate mixY (I translate the whole thing to origin) it
works perfectly

Any help would be greatly appreciated.
Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to