Chapter 2Drawing on a Canvas
Points and vectors may be fundamental to a ray tracer, but without a way to turn them into something visual, most folks won’t care. It’s a good thing you’re about to implement a canvas, then, isn’t it?
A canvas is a kind of virtual drawing board, which your ray tracer will use to turn your scenes into images you can actually see. In this chapter, you’re going to create a canvas that supports millions of colors, and which you can subsequently save as an image file.
To get there, we’ll talk about colors and how to represent them, as well as some color operations that you’ll need to support. Once you’ve got a handle on that, you’ll move on to the canvas itself, and you’ll finish up with a small project to revisualize ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access