4
\$\begingroup\$

How would I go about determining the difference in cost between changing the render color of an object every frame vice changing the texture (same sheet, just changing the source rectangle) every frame?

I ask because right now i'm changing the alpha every frame on about 300-400 objects, and i'm wondering if it isn't cheaper to just simulate that with a couple of frames and cycling through them.

\$\endgroup\$
2
  • \$\begingroup\$ I believe changing the sprite's vertex colors is way faster than swapping textures :) \$\endgroup\$
    – Grimshaw
    Jul 24 '14 at 15:55
  • 1
    \$\begingroup\$ The fastest way is to try it - just spawn few thousands of objects. (be sure to share your answer). Last time I solved this using uniform in shader but never checked if it is the fastest way. \$\endgroup\$
    – wondra
    Jul 24 '14 at 16:44
2
\$\begingroup\$

i do believe changing the color would be much less resource intensive, however the performance depends more on the number of different textures used.

check out this article for a few good bits of ingenuity when it comes to managing textures and performance

http://www.gamasutra.com/view/feature/131768/understanding_and_using_opengl_.php?print=1

my take aways were pretty obvious:

  • to get best performance load your textures from the disk to memory into objects once, then access them
  • you may see performance increase (hardware dependent) by sorting those objects to draw all similar textured objects together.

as long as your only loading the X textures once and not X textures once for each N objects i think your test should prove worth while.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .