Is there an easy way to re-render dynamic vertices in OpenGL ES 2.0 so that one could, for example, make a modeling program?

I understand how to make a dynamic vertex array, but what I don't understand is how to re-render a dynamic array, I've only seen examples where you have to re-compile a shader each time you make an array.

I did find the function:


does this update the data without having to recompile the shader?

  • \$\begingroup\$ You can make a dynamic vertex with three floats. \$\endgroup\$
    – House
    Commented Apr 27, 2013 at 4:52
  • \$\begingroup\$ What Byte56 said. Making vertices dynamic is trivial. Maybe, @mathacka, you meant something else with this question? As for exporting, it depends on the structure of the file type. \$\endgroup\$
    – Attackfarm
    Commented Apr 27, 2013 at 21:47
  • \$\begingroup\$ What I was meaning by "Dynamic Vertices" is when, say you were to subdivide a cube, then you would add 6+4*6 vertices to the model, and anytime you'd add a face or edges to a model. I've just never seen an example of it, I thought I'd have to recompile the shader program in ES 2.0 after making new faces or vertices? \$\endgroup\$ Commented Apr 29, 2013 at 3:39
  • 1
    \$\begingroup\$ Your shaders should be fairly independent of your models. Someone with more expertise might be able to offer a better answer, but I don't see why an altered model would require anything unusual with the shaders. \$\endgroup\$
    – Attackfarm
    Commented Apr 30, 2013 at 3:58
  • \$\begingroup\$ How are you rendering your vertices? It sounds like you're not using a vao/vbo/vetex array. \$\endgroup\$
    – Exilyth
    Commented May 1, 2013 at 11:38

1 Answer 1


The simple answer is YES. You re-render those dynamic vertices once per 'frame' and it is easy. Making a modeling program will be far from easy however.

You don't have the right notion about shaders and vertices. I think you've misunderstood the examples that you've seen. A shader is the program that draws the fragments that make up the screen. That program has two parts, once that is executed once per vertex, and one that is executed once per fragment.

Look at those examples again and trace the code better. Or put a NSLog or printf by the compile call. You'll see that it only compiles it once. If not you need to look for better teaching exaples.

Compiling a shader is something you can do ONCE at the beginning of an app. You can do more often but I never do. I have several general purpose shaders and I compile each at the start and bind the one I need to use when I need to use it. Binding a shader and compiling it are two different things.

Changing vertices dynamically is easy. I have a flag program that applies physics to a grid of vertices that make up a 'cloth' flag. I update the flag once per cycle and then to draw it I call:

    glDrawElements(GL_TRIANGLES, testFlag.m_NumIndices, GL_UNSIGNED_INT, testFlag.m_Indices);

I think you need to do a lot more research on how open gl es 2 works.

If you wanted to write a modeling program you'd have a stack of objects and properties for each one that tell how many vertices and indicies, etc. We call this type of organization a 3d Engine. Then allow users to mod them. But that will be quite the undertaking. Good Luck!


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .