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

Creating groups of controls

When the number of visual controls increases, it's a good idea to organize them into groups. Grouping simplifies navigating through parameters and helps to save screen space from cluttering, by collapsing currently unused groups.

The ofxGuiGroup class is used to create a group of controls. Let's create such a group consisting of three sliders, which will control the scale, rotation, and background of the image:

  1. Add the following lines to the ofApp class's declaration:
      ofxGuiGroup globalGroup;
      ofxFloatSlider Scale;
      ofxFloatSlider Rotate;
      ofxFloatSlider Background;

    The first line declares a group, and the next lines declare sliders for it.

  2. Now set up the group and its controls by adding the following code to the setup()

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