glTranslate or glOrtho to move camera on a 2D game?

Member
Posts: 249
Joined: 2008.10
Post: #1
Hi dudes!

I'm doing a 2D platform game and I'd like to know how do you usually move a camera in this kind of games, using glTranslate or glOrtho? Why?

Thanks.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
glTranslate is the usual way. I hadn't thought of using glOrtho, but I can't think of a reason off the top of my head that it wouldn't work...
Quote this message in a reply
Member
Posts: 249
Joined: 2008.10
Post: #3
ThemsAllTook Wrote:glTranslate is the usual way. I hadn't thought of using glOrtho, but I can't think of a reason off the top of my head that it wouldn't work...

Hi! Thanks for reply.

Let's say I use glTranslate to move my camera (and rotate it for lanscape mode)
How can I do zoom???

Thanks.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #4
riruilo Wrote:How can I do zoom???

Use glScale

"When you dream, there are no rules..."
Quote this message in a reply
Member
Posts: 249
Joined: 2008.10
Post: #5
Taxxodium Wrote:Use glScale

Ohh that's true. So using glScale I avoid calling glOrtho, am I right?

Thanks a lot
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #6
Well, you still have to set up your projection matrix with glOrtho, but we don't typically use it for anything else. So yes, translate/rotate/scale your modelview matrix for anything else, like a virtual camera.
Quote this message in a reply
Member
Posts: 249
Joined: 2008.10
Post: #7
AnotherJake Wrote:Well, you still have to set up your projection matrix with glOrtho, but we don't typically use it for anything else. So yes, translate/rotate/scale your modelview matrix for anything else, like a virtual camera.

OK, thanks a lot.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Move in direction of camera MikeD 3 4,599 Aug 18, 2010 07:33 AM
Last Post: MikeD
  png to pvrtc move kendric 8 6,067 Jul 1, 2009 04:49 AM
Last Post: arekkusu
  Make the terrain move with the character chrism 9 4,503 May 20, 2009 04:15 PM
Last Post: chrism
  how can I move out this bar please ? imaumac 5 3,500 Oct 12, 2008 08:14 PM
Last Post: imaumac