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:
screenArea.minY += zoomSize;
screenArea.maxY -= zoomSize;
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).
I’m doing this with OpenGL ES for the Android platfrom. Might this be a bug, or I’m doing something wrong?
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.