|
|
@ -674,23 +674,23 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
break; |
|
|
|
break; |
|
|
|
case FloatArray: |
|
|
|
case FloatArray: |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
GLES20.glUniform1fv(loc, fb.capacity(), fb); |
|
|
|
GLES20.glUniform1fv(loc, fb.limit(), fb); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Vector2Array: |
|
|
|
case Vector2Array: |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
GLES20.glUniform2fv(loc, fb.capacity() / 2, fb); |
|
|
|
GLES20.glUniform2fv(loc, fb.limit() / 2, fb); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Vector3Array: |
|
|
|
case Vector3Array: |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
GLES20.glUniform3fv(loc, fb.capacity() / 3, fb); |
|
|
|
GLES20.glUniform3fv(loc, fb.limit() / 3, fb); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Vector4Array: |
|
|
|
case Vector4Array: |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
GLES20.glUniform4fv(loc, fb.capacity() / 4, fb); |
|
|
|
GLES20.glUniform4fv(loc, fb.limit() / 4, fb); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Matrix4Array: |
|
|
|
case Matrix4Array: |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
fb = (FloatBuffer) uniform.getValue(); |
|
|
|
GLES20.glUniformMatrix4fv(loc, fb.capacity() / 16, false, fb); |
|
|
|
GLES20.glUniformMatrix4fv(loc, fb.limit() / 16, false, fb); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Int: |
|
|
|
case Int: |
|
|
|
Integer i = (Integer) uniform.getValue(); |
|
|
|
Integer i = (Integer) uniform.getValue(); |
|
|
@ -1685,11 +1685,11 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int usage = convertUsage(vb.getUsage()); |
|
|
|
int usage = convertUsage(vb.getUsage()); |
|
|
|
vb.getData().clear(); |
|
|
|
vb.getData().rewind(); |
|
|
|
|
|
|
|
|
|
|
|
if (created || vb.hasDataSizeChanged()) { |
|
|
|
if (created || vb.hasDataSizeChanged()) { |
|
|
|
// upload data based on format
|
|
|
|
// upload data based on format
|
|
|
|
int size = vb.getData().capacity() * vb.getFormat().getComponentSize(); |
|
|
|
int size = vb.getData().limit() * vb.getFormat().getComponentSize(); |
|
|
|
|
|
|
|
|
|
|
|
switch (vb.getFormat()) { |
|
|
|
switch (vb.getFormat()) { |
|
|
|
case Byte: |
|
|
|
case Byte: |
|
|
@ -1715,7 +1715,7 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
throw new RuntimeException("Unknown buffer format."); |
|
|
|
throw new RuntimeException("Unknown buffer format."); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
int size = vb.getData().capacity() * vb.getFormat().getComponentSize(); |
|
|
|
int size = vb.getData().limit() * vb.getFormat().getComponentSize(); |
|
|
|
|
|
|
|
|
|
|
|
switch (vb.getFormat()) { |
|
|
|
switch (vb.getFormat()) { |
|
|
|
case Byte: |
|
|
|
case Byte: |
|
|
@ -1926,7 +1926,7 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
//ARBDrawInstanced.
|
|
|
|
//ARBDrawInstanced.
|
|
|
|
/* |
|
|
|
/* |
|
|
|
GLES20.glDrawElementsInstancedARB(convertElementMode(mesh.getMode()), |
|
|
|
GLES20.glDrawElementsInstancedARB(convertElementMode(mesh.getMode()), |
|
|
|
indexBuf.getData().capacity(), |
|
|
|
indexBuf.getData().limit(), |
|
|
|
convertFormat(indexBuf.getFormat()), |
|
|
|
convertFormat(indexBuf.getFormat()), |
|
|
|
0, |
|
|
|
0, |
|
|
|
count); |
|
|
|
count); |
|
|
@ -1935,7 +1935,7 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
indexData.clear(); |
|
|
|
indexData.clear(); |
|
|
|
GLES20.glDrawElements( |
|
|
|
GLES20.glDrawElements( |
|
|
|
convertElementMode(mesh.getMode()), |
|
|
|
convertElementMode(mesh.getMode()), |
|
|
|
indexBuf.getData().capacity(), |
|
|
|
indexBuf.getData().limit(), |
|
|
|
convertFormat(indexBuf.getFormat()), |
|
|
|
convertFormat(indexBuf.getFormat()), |
|
|
|
0); |
|
|
|
0); |
|
|
|
} |
|
|
|
} |
|
|
@ -2157,7 +2157,7 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
GLES20.glDrawElements( |
|
|
|
GLES20.glDrawElements( |
|
|
|
convertElementMode(mesh.getMode()), |
|
|
|
convertElementMode(mesh.getMode()), |
|
|
|
indexBuf.getData().capacity(), |
|
|
|
indexBuf.getData().limit(), |
|
|
|
convertFormat(indexBuf.getFormat()), |
|
|
|
convertFormat(indexBuf.getFormat()), |
|
|
|
indexBuf.getData()); |
|
|
|
indexBuf.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|