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

Author Topic: "Cost" of flipping sprites?  (Read 3027 times)

0 Members and 1 Guest are viewing this topic.

M74

  • Newbie
  • *
  • Posts: 17
    • View Profile
"Cost" of flipping sprites?
« on: January 22, 2015, 11:40:46 pm »
Hi,

i`ve read the topic of how to flip a sprite: http://en.sfml-dev.org/forums/index.php?topic=7572.0

I was wondering if this is some sort of unperformant if i have to flip a greater amount of sprites and better should provide also pre-flipped versions of my sprites in my Spritesheet(s) or is it negligable to flip/scale sprites?

Please excuse my english.

Regards,
M74
« Last Edit: January 22, 2015, 11:44:45 pm by M74 »

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: "Cost" of flipping sprites?
« Reply #1 on: January 22, 2015, 11:52:40 pm »
Drawing the sprite flipped(scale = -1) doesn't affect performance at all. Changing the scale just changes some values in a matrix.


AlexAUT

M74

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: "Cost" of flipping sprites?
« Reply #2 on: January 22, 2015, 11:59:36 pm »
Thank you  :)

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: "Cost" of flipping sprites?
« Reply #3 on: January 23, 2015, 04:17:38 pm »
I have to point out that you could have easily tested this on your own.
Just writing a trivial ~20 line program that draws a sprite flipped or not 1 million times and timed it would answer the question.
A profiler could also answer the question of whether the "flip" operation was expensive or not.
Next time you run into a question like this, maybe spending a little time figuring out the answer yourself is worth-while  ;)
« Last Edit: January 23, 2015, 06:29:41 pm by Jesper Juhl »

 

anything