O'Reilly logo

openFrameworks Essentials by Denis Perevalov, Igor Tatarnikov

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

Deforming a sphere

Deformation, that is, changing the geometry of a surface, gives an opportunity to create new and unusual 3D shapes. We will explore two methods of deformation: shifting the sphere's vertices using analytical formulas and extruding the sphere's surface using a texture's pixels values.

To implement this, let's start with adding several sliders to control deformation in the following way:

  1. Declare new sliders in the ofApp class:
    ofxFloatSlider rad, deform, deformFreq, extrude;

    This line declares four sliders: sphere radius, amount and frequency of analytical deformation, and amount of extrusion.

  2. Add commands to set up sliders to setup() after the mixerGroup.add( show3d.setup... command:
    mixerGroup.add( rad.setup("rad", 250, 0, 500) ); ...

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