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

A simple drawing

The simplest thing that can be drawn with openFrameworks is a geometric primitive such as a line, rectangle, or circle. Before drawing, we should set the drawing color using the ofSetColor function and then draw primitives using commands such as ofLine, ofRect, ofTriangle, and ofCircle (they draw a line, rectangle, triangle, and circle respectively). Let's consider setting the color and then drawing functions in detail.

Setting drawing color

The ofSetColor function switches the drawing color to a specified color. There are several overloaded versions of this function:

  • The most universal form lets us explicitly specify the red, green, blue, and alpha (opaqueness) components of the color:
    ofSetColor( 255, 0, 0, 255 );

    The arguments are ...

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