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

Implementing a simple GUI panel with sliders

Let's create a simple GUI consisting of a panel and three sliders. The first thing required is to add the ofxGui addon to the project. Fortunately, we already did it when creating the project in the previous chapter (see step 4 (Selecting the addons) of the Creating a project section of Chapter 2, Creating Your First openFrameworks Project). Perform the following steps:

  1. Include the addon's header to the ofApp.h file by inserting the following line (after the #include "ofMain.h" line):
    #include "ofxGui.h"
  2. Next, declare the visual panel and four sliders by adding the following lines to the ofApp class' declaration:
    ofxPanel gui;
    ofxIntSlider countX;
    ofxFloatSlider stepX;
    ofxFloatSlider twistX;

    The first line ...

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