0

I have an unknown amount of polygons, all facing the camera (-z) with different positions. I want to rotate each polygon around its center by different angles. Would it be faster to use glRotate and glTranslate, or to calculate the rotation myself, or to do something else?

timedt
  • 1,302
  • 2
  • 9
  • 14
  • Are we talking billboarding, or do you need to apply rotations on top of that? – Andreas Haferburg May 04 '13 at 16:04
  • @AndreasHaferburg Pretty much yes, for the moment. Does it make a difference? – timedt May 04 '13 at 16:08
  • For billboarding you don't have to rotate anything **if** you were using an orthographic projection while rendering. You could compute the translation and scale using your own perspective projection, then render with glOrtho. Does it really matter though? Is the code you have too slow, or are asking for best practices? – Andreas Haferburg May 04 '13 at 16:18
  • @AndreasHaferburg Mostly for best practices, but it might come to a point where I need it to be fast. – timedt May 04 '13 at 16:27
  • 1
    My advice is to get to that point first. Optimize last may not always be optimal, but worrying about particular optimizations tends to get in the way. If you don't know why your program is slow, you shouldn't start optimizing. Even less so, if you don't even know **if** your program is slow. :) – Andreas Haferburg May 04 '13 at 16:33
  • @AndreasHaferburg It's getting more fps than it should and about 90K updates/second. I guess that isn't slow. And I would probably stop using direct mode first when it comes to optimization. – timedt May 04 '13 at 16:45

0 Answers0