Hi all,
I am doing a simple texture slicer. At the initialization, i setup the slicing direction and setup my vao/vbo as follows,
glGenVertexArrays(1, &vaoID);
glGenBuffers (1, &vboID);
glBindVertexArray(vaoID);
glBindBuffer (GL_ARRAY_BUFFER, vboID);
glBufferData (GL_ARRAY_BUFFER, sizeof(vTextureSlicer), &(vTextureSlicer[0].x), GL_STREAM_COPY);
glEnableVertexAttribArray(shader["vVertex"]);
glVertexAttribPointer (shader["vVertex"], 3, GL_FLOAT, GL_FALSE, sizeof(Vertex),0);
glBindVertexArray(0);
I passed GL_STREAM_COPY since my data is changed each frame. Based on the current viewing direction the slicing is carried out and the data is updated as follows,
//render code and modelview setup
//vTextureSlicer contains new positions
CalcNewData(viewDir, vTextureSlicer);
glBindVertexArray(vaoID);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vTextureSlicer), &(vTextureSlicer[0].x));
and then follow it with a draw call
glDrawArrays(GL_TRIANGLES,0, sizeof(vTextureSlicer)/sizeof(vTextureSlicer[0]));
however it does not draw anything. If i remove the per frame data update part, it renders fine? what may be causing this. I have tried GL_DYNAMIC_[DRAW/COPY] and GL_STREAM_[COPY/DRAW] to no avail.