如何在 iOS 的 openframeworks 中构建 3d 钻石?我很难在 openframeworks 中找到有用的 3d 渲染教程,而且我来自 Processing。
1 回答
I think there are two sides of the story:
- the nerdy openframeworks/c++/gl part part: how do you actually render a mesh of triangles together
- 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
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):
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