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

Drawing sharp edges

The simplest way to achieve sharp edges is to add the vertices for all the triangles in mesh and not use the addTriangle() function at all and then call the mesh.setupIndicesAuto() function, which sets indices automatically such that vertices (0, 1, 2) are used for drawing the first triangle, vertices (4, 5, 6) for the second triangle, and so on.

Note

This is example 07-3D/04-PyramidSharpEdges. This example is a good starting point for drawing sharp 3D objects.

It is based on example 07-3D/03-PyramidLighting.

In the example with the pyramid, replace all the lines with addVertex() and addTriangle() with the following lines:

//Pyramid's base vertices ofPoint v0 = ofPoint( -200, -100, 0 ); ofPoint v1 = ofPoint( 200, -100, 0 ); ofPoint ...

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