rogue triangles in openGL

hey all,

so i’ve got an iOS program that’s basically a giant mesh, and i’m drawing them with a call to mapVBO.draw(GL_TRIANGLES, 0, numVertices); – i’d like to be able to draw some triangles apart from this mesh, with the same gradient-fill effect that triangles get from openGL. trouble is, i can’t seem to find a way to draw openGL triangles directly, by themselves.

thanks in advance!

you can just use ofTriangle().

but if you’re drawing a ton of individual triangles it’s better to load them all into one mesh and draw at once:

  
  
ofMesh mesh;  
mesh.setMode(OF_PRIMITIVE_TRIANGLES);  
mesh.addVertex(v1);  
mesh.addVertex(v2);  
mesh.addVertex(v3);  
...  
mesh.draw();  
  

oh, cool. that should work great for me - had been under the mistaken impression i had to use a vbo if i used a mesh, but am glad to hear that’s not the case.

thanks kyle!

ofMesh is a generic tool for drawing a collection of points, lines or triangles

ofVbo stores a collection of points, lines or triangles on the graphics card

ofVboMesh uses the uses the ofMesh interface with an ofVbo implementation

if you have a ton of things that are static (not updated every frame) you probably want to use an ofVboMesh. otherwise use an ofMesh. in my opinion, ofVbo should generally not be used.