O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with vertices

There are a number of functions for accessing the vertices and their properties:

  • The getNumVertices() function returns the number of vertices.
  • The getVertex( i ) function returns the position of the vertex with index i.
  • The setVertex( i, p ) function sets the position of vertex i to p. Note that this function can change the vertex but it cannot add a new vertex. So if i is greater or equal to mesh.getNumVertices(), you need to add a vertex (or vertices) using the mesh.addVertex( p ) function as described in the Using ofMesh section.
  • The removeVertex( i ) function deletes the vertex with index i. Be very careful when using this function; after deleting a vertex, you should probably also delete the corresponding normal, color, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required