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

Author Topic: pixel perfect "fix" translates scaled sprites.  (Read 2236 times)

0 Members and 1 Guest are viewing this topic.

dvoid

  • Newbie
  • *
  • Posts: 7
    • View Profile
pixel perfect "fix" translates scaled sprites.
« on: August 10, 2010, 09:26:33 am »
Hello , new to this forum :)

I have a problem with scaling up very small sprites, like 1x1 pixel.
if i want to scale this thing upp to fit the entire screen for example the scaling obviosly has to be quite high. the problem is that the sprite starts to translate
when the scaling becomes higher. the problem is always there though. im trying
to do pixel perfect composition of multiple scaled object and its impossible with the current sprite render code.

this problem is caused by the so called "offset trick" in the sprite render rutine.
"GLCheck(glTranslatef(0.375f, 0.375f, 0.f));" i think that would be fine if it
was done in the correct place in the code, so it was not affected by the object scale.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
pixel perfect "fix" translates scaled sprites.
« Reply #1 on: August 10, 2010, 09:50:39 am »
This is a known bug of SFML 1.6, which is already fixed in SFML 2.0.

There are currently two workarounds to this issue:
- use SFML 1.5
- translate your sprite by -0.375*scale :)
Laurent Gomila - SFML developer

dvoid

  • Newbie
  • *
  • Posts: 7
    • View Profile
pixel perfect "fix" translates scaled sprites.
« Reply #2 on: August 10, 2010, 10:45:45 am »
oh :) thats good.
guess ill switch to 2.0 then, how stable is it at this time?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
pixel perfect "fix" translates scaled sprites.
« Reply #3 on: August 10, 2010, 11:02:35 am »
It's very stable, but the public API of the graphics module may change before the public release.
Laurent Gomila - SFML developer