[icode]vertexData.clear()[/icode]
Edit: Ninja’d
[icode]vertexData.clear()[/icode]
Edit: Ninja’d
I didn’t know there was a clear method. Well, I tried that and now the triangle has even more shading.
trans += 0.1f;
glBufferData(GL_ARRAY_BUFFER, vertexData, GL_DYNAMIC_DRAW);
vertexData.clear();
I just pasted my code so you can check it.
You are not updating the vertices. Add this code in your gameloop.
// Clear the vertices buffer
vertexData.clear();
// Update the trans variable
trans += 0.1f;
// Re-create the vertex data
vertexData.put(new float[]{-0.5f + trans, -0.5f, 0, 0.5f + trans, -0.5f, 0, 0.5f + trans, 0.5f, 0});
vertexData.flip();
// Now, upload to the GPU
glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
glBufferData(GL_ARRAY_BUFFER, vertexData, GL_DYNAMIC_DRAW);
And then render as you usually would. Hope this helps.
It works! ;D I also looked at redbladewarriors’ tutorial on youtube and learned some more things Thank you.
Glad that you got it working. Had to get some sleep now.