

You don't need the indices in the element array to draw lines. GlDrawArrays(GL_LINE_STRIP, 0, current_nb_vertices)

To add a new vertex, use something like this : glBufferSubData(GL_ARRAY_BUFFER, current_nb_vertices*3*sizeof(float), nb_vertices_to_add, newVertices) Ĭurrent_nb_vertices += nb_vertices_to_add You should also use GL_STREAM as the last argument (read up on the function). You need to change the size given to glBufferData to something large enough to hold all the original vertices + those added later. The current size is sizeof(Vertices) as specified in glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW) Im hoping they added something in ES 2.0 for it. Again, I know I remember seeing it for OpenGL because I was really bummed that it wasnt in ES 1.0. What is an optional line Take a look at these two visualization of the standard 2x4 brick found among the LDraw parts (known as 3001.dat ). I need this to work for any defined face with coplanar tris. updateīased on your other question, you seem to be almost there! You already create VBOs like I mentioned but they are probably not large enough. In this tutorial, we are going to see how optional lines can be drawn in OpenGL ES 2.0 for Android using a vertex shader, thus offloading the math onto the GPU. Using VBOs to draw lines or any other OpenGL shape is easy and many tutorials exist to accomplish it. These positions must then be pushed to the VBO with glBufferSubData if the existing VBO is large enough or glBufferData if the existing VBO is too small. Then, the gesture must be converted to a series of positions (I don't know how that happens on your platform). You should use vertex buffer objects (VBOs) as the backing OpenGL structure for your vertex data.
