O'Reilly logo

Cinder – Begin Creative Coding by Krisjanis Rijnieks

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

Exploring other Cinder 3D primitives

Now let's try out the different 3D primitives that Cinder supplies it's own functions for. We just tried to draw a different kind of cube, so let's continue with something equally classic, a sphere. Replace the gl::drawColorCube() function call with the following line:

gl::drawSphere( Vec3f::zero(), 100 );

The first parameter of this function defines the center of the sphere and the second defines the radius. There is a third (optional) parameter int that controls the number of segments the sphere is made of. The default value is 12, but you might want to change it to a higher value to increase the smoothness of the sphere.

Compile and run the project. You should see an image similar to the following screenshot: ...

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