Saturday, 15 March 2014

Android openGL GLES20.glUniformMatrix4fv to java -


I am trying to convert an Android open GL project to Java and am disturbed by me that I Understand about

  `GLES20.glUniformMatrix4fv '(int space, integer count, boolean transjections, float [] value, offset off)  

OpenGL ES I have every 128 floats << P>

  float [] combined matrix; `float [] invBindPoseMatrix; ` 

then these calls are sent to shader

  GLES20.glUniformMatrix4fv (combined matrix handles, 8, false, dae.jenet matrix, 0) ; GLES20.glUniformMatrix4fv (invBindPoseMatrixHandle, 8, False, DAE.invBindPoseMatrix, 0); ' 

It gets in the shade

  Uniform Matte 4 Combined Metrics [8] Uniform Unmatched 4 InvBindPoseMatrix [8]  

> My question is, has Android sent the entire 128 items float array with the same call, and automatically subdivided it into 8 4x4 matrix? With 16 offsets. 0-15-31- etc ..?

The answer is: yes .

You can eliminate it. There is really no magic in it, in most languages, elements of the array are indexed in memory. So if you look at the memory layout of an array of 8 4x4 matrix, then it's just a sequence of 8 * 4 * 4 = 128 floats. They will be interpreted in a certain way because the manner in which Array was declared, but as far as memory layout goes, it is similar to an array of 128 floats.

Therefore, with the count of 8 glUniformMatrix4fv () provides the contents of this memory since 8 matrix, as mentioned above, an array of 8 matrix memory There is only 128 float sequences, it consumes 128 floats, and copies them directly into the memory used by the matrix array.

One aspect to be careful about the matrix in OpenGL is that they have been placed in the column heading. This is your glUniformMatrix4fv () .

must be kept in mind in the order of matrix elements

No comments:

Post a Comment