Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenFrameworks Essentials

You're reading from   OpenFrameworks Essentials Create stunning, interactive openFrameworks-based applications with this fast-paced guide

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781784396145
Length 206 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with openFrameworks FREE CHAPTER 2. Creating Your First openFrameworks Project 3. Adding a GUI and Handling Keyboard Events 4. Working with Raster Graphics – Images, Videos, and Shaders 5. Creating 3D Graphics 6. Animating Parameters 7. Distributed and Physical Computing with Networking and Arduino 8. Deploying the Project on iOS, Android, and Raspberry Pi 9. Further Resources A. Video Synthesizer Reference B. openFrameworks Quick Reference Index

Introduction to 3D graphics with openFrameworks

3D graphics is based on using the three-axes coordinate system (X, Y, Z). The X and Y coordinates are directed in exactly the same way as in 2D's case, and the additional Z axis is perpendicular to the screen plane and directed at us.

Note

Actually, openFrameworks draws everything as 3D graphics. When we draw anything using 2D drawing commands, just as we did in the previous chapters, openFrameworks uses Z as being equal to zero.

Most of openFrameworks' 2D drawing functions that we already know have their similar 3D counterparts. For example, consider the commands:

ofLine( 10, 20, 30, 40, 50, 60 );
ofTriangle( 100, 200, 300, 400, 500, 600, 700, 800, 900 );

These will draw a line segment between the points with coordinates (10, 20, 30) and (40, 50, 60) and a triangle with vertices (100, 200, 300), (400, 500, 600), and (700, 800, 900).

Tip

To simplify the code, you can use the ofPoint class, which represents a 3D point or vector. It has...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image