Book Image

OpenFrameworks Essentials

Book Image

OpenFrameworks Essentials

Overview of this book

Table of Contents (19 chapters)
openFrameworks Essentials
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a camera


One of the advantages of 3D graphics over 2D graphics is the possibility of walking through the virtual scene and rotating objects in a way we do in real life. So the user feels as though he or she were inside that scene, observing real objects. The navigating in space is achieved using a camera. It is a special object that controls the way of projecting 3D points to 2D points on the screen.

Tip

There are two types of projections from 3D to 2D:

  • Perspective projection: Far-off objects look smaller than nearby objects. This is the type of projection used in openFrameworks by default.

  • Orthogonal projection: The visible size of an object does not depend on the distance to the viewer.

In openFrameworks, a camera can be represented by the ofCamera class or the ofEasyCam class. The first class is a quite general camera class, and the second one extends it by implementing a number of additional capabilities, including handling mouse events for controlling the camera.

Tip

To enable orthogonal...