Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it better to use GL_FIXED or GL_FLOAT on Android

I would have assumed that GL_FIXED was faster, but the iPhone docs actually say to use GL_FLOAT because GL_FIXED has to be converted to GL_FLOAT. Is it the same on Android? I suppose it varies by phone, but what about recent popular ones (Nexus One, Droid/Milestone, etc.)?

Bonus points: This appears to be completely undocumented (e.g. search google for GL_FIXED!) but where is the 'point' in GL_FIXED? I.e. how much is (GL_FIXED)1 worth?

like image 284
Timmmm Avatar asked Feb 26 '23 23:02

Timmmm


2 Answers

Like Andreas says, which one is faster depends on the hardware rather than on the gl standard. In general, you can expect GL_FLOAT to probably be the better choice when true hardware acceleration is used. GL_FIXED will usually be faster if the work is done in software on a CPU with poor or zero support for floating point math.

GL_FIXED is a 32 bit format, using 16.16 semantics. So 1 as a GL_FIXED value would be 0x10000.

like image 142
Alan Avatar answered Mar 06 '23 17:03

Alan


This has nothing to do with android, it will depend on the actual GPU in the telephone in question. Generally I would think that GL_FLOAT will be faster on modern GPUs.

like image 21
Andreas Brinck Avatar answered Mar 06 '23 18:03

Andreas Brinck