I am trying Rajawali library for Android to draw some basic 3d objects on the scene. There is a sample 2000 planes, which show how to render huge amount of vertexes very "cheaply" with one shader. I can pass array of vertexes to the shader and draw them.
I want to upgrade this sample and move some vertexes independently from each other.
I've tried glBufferSubData, but i cant change anything on the scene. The one way i've found is to change data and recreate buffer, but i hope there is a simpler way to only change the necessary data.
For example, I only want to change some positions from already created and binded buffer.
initialize positions
float[] planePositions = new float[numVertices * 3];
....
create buffer
mGeometry.createBuffer(mPlanePositionsBufferInfo, BufferType.FLOAT_BUFFER, mPlanePositions, GLES20.GL_ARRAY_BUFFER);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
set positions
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, planePosBufferHandle);
GLES20.glEnableVertexAttribArray(maPlanePositionHandle);
fix.android.opengl.GLES20.glVertexAttribPointer(maPlanePositionHandle, 3, GLES20.GL_FLOAT,
false, 0, 0);
and how can i modify position of, for example, the first vertex of the first plane ? (planePositions[0] = a;planePositions[1] = b; planePositions[1] = c... and now i have to pass this modified array to opengl but don't know how).