This site is no longer active and is available for archival purposes only. Registration and login is disabled.

opengl zoom


opengl zoom

Postby jrhee » Sep 13, 2009 @ 9:23pm

I'm putting together a game where all the graphics must be drawn into 240x208 pixels. Depending on my platform, I'd like to be able to zoom into that space so it fits the width of the screen.

I looked at the PinchZoom demo where it looks like zooming is achieved by blit scaling the edgelib logo. I considered drawing my graphics onto such a surface and scaling it to achieve the desired effect, but then I'd have to upload the surface on each frame, which would impact performance. Would it be possible to adjust the zoom by changing the openGL/view settings instead, while retaining the blending I noticed in the PinchZoom approach?
jrhee
pm Member
 
Posts: 26
Joined: Apr 7, 2008 @ 4:28pm


Postby edge » Sep 14, 2009 @ 8:45am

Hi,

The function you need is glViewport, it changes the dimension of the viewport and scales up graphics.

Alternatively, you can also use Perspective2D with your resolution (use 240x208 as parameters). This only works if you're using 2D graphics however.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby jrhee » Sep 15, 2009 @ 11:54am

jrhee
pm Member
 
Posts: 26
Joined: Apr 7, 2008 @ 4:28pm


Postby edge » Sep 15, 2009 @ 12:34pm

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby jrhee » Oct 8, 2009 @ 3:29am

jrhee
pm Member
 
Posts: 26
Joined: Apr 7, 2008 @ 4:28pm


Postby edge » Oct 9, 2009 @ 7:47am

Hi,

The choppiness could be explained by the scaling factor. When scaling 150%, sometimes the character walks 1 pixel, and then 2 pixels. The lines appear because of internal rounding errors in OpenGL.

I'm affraid there is little you can do about this. The recommended approach is to scale up graphics and modify your routine so your entities move properly over the increased tile size. You could also show more of the game area (because more tiles fit on the larger resolution).
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron