Results 1 to 2 of 2

Thread: Zooming in a 2d game

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    3

    Zooming in a 2d game

    Hi,

    I'm trying to zoom a parallax background.

    I'm using glOrthof:

    pGL.glOrthof(0, pCamera.getWidth(), pCamera.getHeight(), 0, -1f, 1f);

    where the camera width and height takes into account the zoom factor.

    I then draw my various parallax layers.

    This works fine apart from the fact the zoom occurs from the top left of the layers. I'd like the zooming to be centered on a sprite whose position is x,y

    I assumed that I should apply a translation using glTranslatef before zooming. This doesnt seem to be working.

    Any thoughts?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2011
    Location
    Paris, France
    Posts
    281

    Re: Zooming in a 2d game

    GL transformations are make in the reverse order of the "logic order"
    => have you test to use your glTranslatef after zoomming ?
    @+
    Yannoo

Similar Threads

  1. zooming
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-10-2005, 11:29 AM
  2. Zooming
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-19-2004, 07:11 AM
  3. zooming
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-18-2004, 03:26 PM
  4. Zooming in and out
    By SurGL in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-14-2001, 10:57 PM
  5. zooming
    By David in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-04-2001, 02:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean