Floating point or fixed-point for Android NDK OpenGL apps?

Older Android devices like the G1 and MyTouch have ARMv6 CPUs without floating point support. Most newer devices, like the Droid, Nexus One, and Incredible, use ARMv7-A CPUs that do have FP hardware. If your game is really 3D-intensive, it might demand more from the 3D implementation than the older devices can provide anyway, so you need to decide what level of hardware you want to support If you code exclusively in Java, your app will take advantage of the FP hardware when available.

If you write native code with the NDK, and select the armv5te architecture, you won't get hardware FP at all. If you select the armv7-a architecture, you will, but your app won't be available on pre-ARMv7-A devices OpenGL from Java should be sitting on top of "direct" byte buffers now, which are currently slow to access from Java but very fast from the native side. (I don't know much about the GL implementation though, so I can't offer much more than that.) Some devices additionally support the NEON "Advanced SIMD" extension, which provides some fancy features beyond what the basic VFP support has.

However, you must test for this at runtime if you want to use it (looks like there's sample code for this now -- see the NDK page for NDK r4b) An earlier answer has some info about the gcc flags used by the NDK for "hard" fp Ultimately, the answer to "fixed or float" comes down to what class of devices you want your app to run on. It's certainly easier to code for armv7-a, but you cut yourself off from a piece of the market.

Older Android devices like the G1 and MyTouch have ARMv6 CPUs without floating point support. Most newer devices, like the Droid, Nexus One, and Incredible, use ARMv7-A CPUs that do have FP hardware. If your game is really 3D-intensive, it might demand more from the 3D implementation than the older devices can provide anyway, so you need to decide what level of hardware you want to support.

If you code exclusively in Java, your app will take advantage of the FP hardware when available. If you write native code with the NDK, and select the armv5te architecture, you won't get hardware FP at all. If you select the armv7-a architecture, you will, but your app won't be available on pre-ARMv7-A devices.

OpenGL from Java should be sitting on top of "direct" byte buffers now, which are currently slow to access from Java but very fast from the native side. (I don't know much about the GL implementation though, so I can't offer much more than that. ) Some devices additionally support the NEON "Advanced SIMD" extension, which provides some fancy features beyond what the basic VFP support has.

However, you must test for this at runtime if you want to use it (looks like there's sample code for this now -- see the NDK page for NDK r4b). An earlier answer has some info about the gcc flags used by the NDK for "hard" fp. Ultimately, the answer to "fixed or float" comes down to what class of devices you want your app to run on.It's certainly easier to code for armv7-a, but you cut yourself off from a piece of the market.

1 I knew that fadden had the answer to this. I wish I could vote up more than once :) I'm already restricting myself to OpenGL ES 2.0 so I can write vertex and fragment shaders, so I guess I may as well go all the way and require ARMv7 (which probably goes hand in hand). I'd rather attract more people of a smaller user base with a great-looking app than throw some garbage at the masses.

They mostly stopped making games for the PlayStation 1 by now too. – EboMike Aug 2 '10 at 23:05 1 You should go for float on ARMv7 then. It doesn't go hand in hand with OpenGL ES 2.0, but it's close – ognian Aug 3 '10 at 6:33 It appears that most new phones have OpenGL ES 2.0.

However, I looked at benchmark scores, such as the AnTuTu benchmark, and found that many of the lower priced models are without FPU. – Boris van Schooten Aug 25 at 7:27.

In my opinion you should stick with fixed-point as much as possible. Not only old phones miss floating point support, but also new ones such as the HTC Wildfire. Also, if you choose to require ARMv7, please note that for example the Motorola Milestone (Droid for Europe) does feature an ARMv7 CPU, but because of the way Android 2.1 has been built for this device, the device will not use your armeabi-v7a libs (and might hide your app from the Market).

I personally worked around this by detecting ARMv7 support using the new cpufeatures library provided with NDK r4b, to load some armeabi-v7a lib on demand with dlopen().

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions