On most Android devices, should I expect performance gains if I do all my calculations / rendering of OpenGL vertices in Integers instead of Floats?
I recently switched from using the OpenGL viewport to 0: width, 0: height instead of -1: 1, -1: 1, so I can get away with converting all my calculation / drawing buffers to Ints instead of Floats if this is desirable for performance.
For example, if I do many of the following types of calculations and rendering in my application.
float x1 = someFloatCalculation(foo);
float x2 = someFloatCalculation(bar);
float y1 = someOtherFloatCalculation(foo);
float y2 = someOtherFloatCalculation(bar);
FloatBuffer buf = makeFloatBuffer(new float[] { x1, y1, x2, y1, x1,
y2, x2, y2 });
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, buf);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
Can this be accelerated by switching to something like
int x1 = someIntCalculation(foo);
int x2 = someIntCalculation(bar);
int y1 = someOtherIntCalculation(foo);
int y2 = someOtherIntCalculation(bar);
IntBuffer buf = makeIntBuffer(new int[] { x1, y1, x2, y1, x1,
y2, x2, y2 });
gl.glVertexPointer(2, ???GL10.GL_INT???, 0, buf);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
Note that the calculations will be completely equivalent in the two examples, except that the latest versions simply round the result to the nearest int.
, , , 0 0 ( ). , float, OpenGL "" , int, ?