I'm developing a cloth simulator in WebGL, got all the physics and the animation ready but I just can't render it. I am used to use glVertex in Opengl, so in every iteration I can change the position of the vertex and it will move, but in WebGL (OpenGL ES) there is not such method.
This is my code:
//Initialization:
puntosBuffer= gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, puntosBuffer);
telaVertices3=new Array(12);
telaVertices3=[
0.0,0.0,0.0,
2.0,0.0,0.0,
1.0,1.7,0.0,
0.0,1.0,0.0
];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(telaVertices3), gl.DYNAMIC_DRAW);
//loop:
posx=posx+0.2;
telaVertices3[0]=posx;
gl.bindBuffer(gl.ARRAY_BUFFER, puntosBuffer);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, new Float32Array(telaVertices3));
But it always renders at the same points!!!