Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Zooming in with a View - 'Corrupting' sprites?  (Read 397 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 16
    • View Profile
Zooming in with a View - 'Corrupting' sprites?
« on: May 09, 2015, 04:15:11 am »
Hi, I have a curious problem.

In my game, I'm generating a 40 x 30 grid of sprites (as a 'dungeon'), each sized 32 x 32.

My window size is 640 x 480.

So, the view to see the entire dungeon would be 1280 x 960, with the center as 640 x 480.

That's fine, and that view works, nothing is corrupted.

However, when I try zooming in so I can see a part of the dungeon (in this case, changing the view size to 480 x 360, and the center to the player's position), my sprite's details are 'corrupted', where some lines are thicker than others.

Here's a few pictures to better illustrate my point.

Zoomed out (1280 x 960):

Zoomed in (480 x 360):

Can anyone explain what is happening here?

My code, for reference.

        if (viewToggle) {
            view.setSize(480, 360);
        } else {
            view.setSize(1280, 960);
            view.setCenter(640, 480);
where 'rt' is the render target, first block is zoomed in, second block is zoomed out.


Fixed by scaling to an integer value, e.g. 2x zoom as opposed to 2.67 zoom. Fractional pixels are bad.
« Last Edit: May 09, 2015, 06:31:39 am by tetra »