Steady zoom on center in LWJGL (Modelview)

Posted by l5p4ngl312 on Game Development See other posts from Game Development or by l5p4ngl312
Published on 2011-11-30T01:32:00Z Indexed on 2011/11/30 2:07 UTC
Read the original article Hit count: 404

Filed under:
|
|

I am having a problem in LWJGL with zooming in and out. I am using glScaled(zoom, zoom, 1) before glTranslated. There are 2 problems: 1. The rate of zoom speeds up a lot when zooming out (lower zoom value). 2. It zooms in on the bottom left corner of the screen rather than the center. Eventually, I would like to have the zoom focused on the mouse position.

I have tried to fix these problems by make it glScaled(zoom^12, zoom^12, 1) so that the greater the zoom value, the faster it will zoom in order to balance out the faster zoom at lower zoom values. To compensate for the zoom focused on the bottom left, I have tried to subtract (zoom+1)^10 + 2^10 from the X and Y of each sprite. This results in a curved zoom path, first to the left and then to the right. It is a 2D game.

© Game Development or respective owner

Related posts about 2d

Related posts about java