From e9395812bc72d546d8ab1ad4190099ec0d96bfe5 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 10 Nov 2012 22:03:37 +0000 Subject: [PATCH] * Partial fix for issue 504 (Android renderer only) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9990 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../renderer/android/OGLESShaderRenderer.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java index a14452b4d..54a42f84f 100644 --- a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java +++ b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java @@ -674,23 +674,23 @@ public class OGLESShaderRenderer implements Renderer { break; case FloatArray: fb = (FloatBuffer) uniform.getValue(); - GLES20.glUniform1fv(loc, fb.capacity(), fb); + GLES20.glUniform1fv(loc, fb.limit(), fb); break; case Vector2Array: fb = (FloatBuffer) uniform.getValue(); - GLES20.glUniform2fv(loc, fb.capacity() / 2, fb); + GLES20.glUniform2fv(loc, fb.limit() / 2, fb); break; case Vector3Array: fb = (FloatBuffer) uniform.getValue(); - GLES20.glUniform3fv(loc, fb.capacity() / 3, fb); + GLES20.glUniform3fv(loc, fb.limit() / 3, fb); break; case Vector4Array: fb = (FloatBuffer) uniform.getValue(); - GLES20.glUniform4fv(loc, fb.capacity() / 4, fb); + GLES20.glUniform4fv(loc, fb.limit() / 4, fb); break; case Matrix4Array: fb = (FloatBuffer) uniform.getValue(); - GLES20.glUniformMatrix4fv(loc, fb.capacity() / 16, false, fb); + GLES20.glUniformMatrix4fv(loc, fb.limit() / 16, false, fb); break; case Int: Integer i = (Integer) uniform.getValue(); @@ -1685,11 +1685,11 @@ public class OGLESShaderRenderer implements Renderer { } int usage = convertUsage(vb.getUsage()); - vb.getData().clear(); + vb.getData().rewind(); if (created || vb.hasDataSizeChanged()) { // upload data based on format - int size = vb.getData().capacity() * vb.getFormat().getComponentSize(); + int size = vb.getData().limit() * vb.getFormat().getComponentSize(); switch (vb.getFormat()) { case Byte: @@ -1715,7 +1715,7 @@ public class OGLESShaderRenderer implements Renderer { throw new RuntimeException("Unknown buffer format."); } } else { - int size = vb.getData().capacity() * vb.getFormat().getComponentSize(); + int size = vb.getData().limit() * vb.getFormat().getComponentSize(); switch (vb.getFormat()) { case Byte: @@ -1926,7 +1926,7 @@ public class OGLESShaderRenderer implements Renderer { //ARBDrawInstanced. /* GLES20.glDrawElementsInstancedARB(convertElementMode(mesh.getMode()), - indexBuf.getData().capacity(), + indexBuf.getData().limit(), convertFormat(indexBuf.getFormat()), 0, count); @@ -1935,7 +1935,7 @@ public class OGLESShaderRenderer implements Renderer { indexData.clear(); GLES20.glDrawElements( convertElementMode(mesh.getMode()), - indexBuf.getData().capacity(), + indexBuf.getData().limit(), convertFormat(indexBuf.getFormat()), 0); } @@ -2157,7 +2157,7 @@ public class OGLESShaderRenderer implements Renderer { } else { GLES20.glDrawElements( convertElementMode(mesh.getMode()), - indexBuf.getData().capacity(), + indexBuf.getData().limit(), convertFormat(indexBuf.getFormat()), indexBuf.getData()); }