Doubling with ogle in Android I want to make some triangles and translate them. Sufficiently simple
I look at the examples and see that floatbowers are recommended to build storage for polygon coordinates using GLES in Android, because they are on the native code Steroid Good thing! Explanation here
Now what is deceptive for me, It is being said, but on the other hand, what every change I want to do, is to see it now?
float [myJavaFloatArray = new float [polylength]; MyFloatBuffer.get (myJavaFloatArray); Matrix.translateM (myJavaFloatArray, 0, -1.0f, 0.0f, 0.0f); MyFloatBuffer.put (myJavaFloatArray); Is this really the best practice? Is there a perception that my proportion draws for translation will be quite low that this expense is worth it? What if I am doing a lot of translation, one on every frame per object is that one argument to use the Java float arrays?
First of all, there is no way for array () Code> floatbuffer returns float [] indicates the value for direct buffer data? You should use it in the translation system so that you do not copy data around memory, for this, the 4 lines of your line should be changed in one line: matrix.buffer. Array (), 0, -1.0f, 0.0f, 0.0f); Secondly, it is not the best practice to change your top stats on the CPU, you have a peak shader adher for this and use the matrix and push them on the GPU so that you get the benefit of it Can afford. In addition, if you corrupt those data, then you change it like this: If float is the top object for some objects in the buffer in which you want to attract in many places, Before translating it to the place, it will need to translate 0. There are several examples for each draw call or for top figures. Either way, although the array can be very easy to be able to change the buffer, should avoid using frames per second if possible. While preparing some element, do it in loading time or in the background. If you are working with ES1 and you do not have a top reader for per frame, then there are still matrix operations that work in the same way (translation, rotate, scale , Set, push, pop ...)
No comments:
Post a Comment