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 integers from 0 to 255, which correspond to red, green, or blue color components and alpha color components. In our example, we will get the red opaque color because the red component is maximal, the blue and green components are zero, and...