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

Mixing 2D and 3D with the GUI

Let's create two sliders and use them to mix 2D and 3D graphics using the following steps:

  1. Declare a new slider and a new offscreen buffer for storing the sphere image in the ofApp class:
    ofxFloatSlider show2d, show3d;
    ofFbo fbo3d;
  2. Add commands to set up sliders and the offscreen buffer to setup(), after the mixerGroup.add( ky.setup... command:
    mixerGroup.add( show2d.setup("show2d", 255, 0, 255) );
    mixerGroup.add( show3d.setup("show3d", 255, 0, 255) );
    fbo3d.allocate( ofGetWidth(), ofGetHeight(), GL_RGBA );

    The first and second lines set sliders to have a range from 0 to 255 and add them to the GUI group mixerGroup (this group was created in the previous chapter). The third line allocates the offscreen buffer with size ...

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