OpenGL ES - how to keep some object at a fixed size?

Posted by OMH on Stack Overflow See other posts from Stack Overflow or by OMH
Published on 2009-11-17T08:57:53Z Indexed on 2010/05/04 21:58 UTC
Read the original article Hit count: 222

Filed under:
|
|

I'm working on a little game in OpenGL ES.

In the background, there is a world/map. The map is just a large texture. Zoom/pinch/pan is used to move around. And I'm using glOrthof (left, right, bottom, top, zNear, zFar) to implement the zoom/pinch. When I zoom in, the sprites on top of the map is also zoomed in. But I would like to have some sprites stay at a fixed size.

I could probably calculate a scale factor, depending on the parameters to glOrthof, but there must be a more natural and straightforward way of doing that, instead of scaling the sprites down when I zoom in.

If I add some text or some GUI elements on top of the map, they should definately have a fixed size.

Is there a solution to do this, or do I have to leave fixed values in glOrthof and implement zoom/pinch in another way?

EDIT: To be more clear: I want sprites that zoom in/out along with the map, but stay at the same size. I have some elements that are like the pins on the iPhone's map application. When you zoom, the pins stay the same size, but move around on the screen to stay on the same spot on the map. That is mainly what I want a solution for. Solutions for this already came below, thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk