Hi all
I try to update a vbo via data texture filled with positions. The positions represent points on a smooth surface like a cloth.
The texture is updated from a fragment shader that calculates forces and points positions.
I init my vbo like that:
glGenBuffers(1, &vboID);
glBindBuffer(GL_ARRAY_BUFFER, vboID);
glBufferData(GL_ARRAY_BUFFER, size, 0, GL_DYNAMIC_DRAW);
glVertexAttribPointer (0, 4, GL_FLOAT, GL_FALSE, 0, 0) ;
glBindBuffer(GL_ARRAY_BUFFER, 0);
do my calculations in the shader
and copy the texture data to the vbo
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindBuffer(GL_PIXEL_PACK_BUFFER, vboID);
glReadPixels(0, 0, texture_size_x, texture_size_y, GL_RGBA, GL_FLOAT, 0);
glReadBuffer(GL_NONE);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
and try to show it … but here it’s broken
so I’m not sure of this part
glEnableVertexAttribArray (0);
glBindBuffer(GL_ARRAY_BUFFER, vboID);
// error glDrawElements(GL_TRIANGLES, (GLsizei)indices.size(), GL_UNSIGNED_SHORT, &(indices[0]));
the error occurs on the draw command. error 1282 means Invalid operation.
can someone help me to find out the problem
thanks