Search code examples
c++ios3dopenframeworkscinder

How to build a 3d diamond in openframeworks for iOS


How to build a 3d diamond in openframeworks for iOS? I'm having a hard time finding useful tutorials for 3d rendering in openframeworks, and I am coming from Processing.


Solution

  • I think there are two sides of the story:

    1. the nerdy openframeworks/c++/gl part part: how do you actually render a mesh of triangles together
    2. the fun part: geometry

    For the 1st part I recommend starting with the oF documentation on ofVbo. The article shows you how to render an icosahedron which with flat shading (and optionally perhaps basic subdivision) can look like a diamond

    ofVbo

    The point is you need to get used to working with vbos, vertices and faces. Once you've got the hang of that you can explore geometry

    You can work out the indices to draw a common diamond (using the polar to cartesian formula and a bit of offsetting/scaling):

    diamond

    Or you can explore geometry further by looking at:

    • platonic solids (see icosahedron/dodecahedron)
    • archimidean solids
    • polar zonohedron maybe ? (I played with this a bit in Processing porting Rob Bell's Polar Zonohedron free Sketchup Ruby Script, plenty of interesting geometry on his site)

    If you have the time also explore resources from geometers like Paul Bourke or George Hart