Phonations/Joker — pull request #219 by tlecomte (2014-07-09 15:30:57+00:00)
Title: Tweak video pixel format for faster OpenGL texture loading

Dear Joker developers,

This pull request contains a standard optimization to the OpenGL texture uploading.

Instead of sending a RGB buffer to the card, send a BGRA buffer. The 32-bits alignment and the blue/red order are likely to be native to the video card, avoiding costful conversions.

This combination is reported to best here:
http://www.opengl.org/wiki/Common_Mistakes#Image_precision
https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/opengl-macprogguide/opengl_texturedata/opengl_texturedata.html#//apple_ref/doc/uid/TP40001987-CH407-SW1

On a Windows 7 PC with Intel HD Graphics card, timing the glTexSubImage2d calls produces the following results:

-before the commit: Mean = 9.4 ms, standard dev = 1.5 ms
-after the commit: Mean = 5.4 ms, standard dev = 1.6 ms

Since there is only 16.6 ms available between two frames (@ 60 Hz), the improvement is not negligible!

Thanks for your attention!