O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

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

Chapter 2. Drawing in 2D

Drawing is one of the main capabilities of openFrameworks. Here, we consider the basics of 2D graphics, including drawing geometric primitives, working with colors, and drawing in an offscreen buffer. In this chapter we will cover:

  • Geometric primitives
  • Using ofPoint
  • Coordinate system transformations
  • Colors
  • Using FBO for offscreen drawings
  • Playing with numerical instability
  • Screen grabbing

Drawing basics

The screens of modern computers consist of a number of small squares, called pixels (picture elements). Each pixel can light in one color. You create pictures on the screen by changing the colors of the pixels.

Note

Graphics based on pixels is called raster graphics. Another kind of graphics is vector graphics, which is based on primitives ...

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