1
\$\begingroup\$

I'm currently using opengl es 1.1 for simple 2D drawing and I was wondering if it would actually be inefficient to use the opengl transform functions (since using matrix operations to move a square seems like unnecessary work), and if directly modifying the vertex array would be a better idea.

\$\endgroup\$
  • \$\begingroup\$ Instanced rendering is faster than both of those, but you really shouldn't care about performance in a 2d game, especially this early \$\endgroup\$ – Bálint Jul 29 '17 at 15:48
  • \$\begingroup\$ From your other question you're using OpenGL ES 1.1; please edit this question to state this explicitly because it has huge influence on the answer you'll get (i.e. no buffers, fixed function transforms, no shaders, etc). \$\endgroup\$ – Maximus Minimus Jul 30 '17 at 2:40
2
\$\begingroup\$

This is a micro-optimization. How would you modify the vertex array? Would you upload it to the card again from main memory? If so, that will be much slower than 4 vertices doing a matrix multiply in parallel, which is likely to be what will happen using the transform functions.

In general, you should profile your code to see where the slowdowns are rather than guessing and trying to optimize before you know. What you've described so far doesn't sound very taxing on the hardware. Also, when you do find an area that needs to be optimized, you're often better off choosing a better algorithm than optimizing the implementation you currently have. (Unless of course you know that you're using the optimal algorithm.)

\$\endgroup\$
  • \$\begingroup\$ OP is using GL ES 1.1; no buffers. \$\endgroup\$ – Maximus Minimus Jul 30 '17 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.