Introduction to Computer Graphics, Version 1.2
This textbook represents my attempt to develop a modern, one-semester first course in computer graphics, which would typically be taken by a computer science student in the third or fourth year of college. (Whether it will continue to be appropriate is an open question, given the always-rapid changes in the field of computer graphics.)
I used Version 1.0 of this book for a course in Fall 2015. Version 1.1 corrected some errors and typos and added some material. It was used in the Fall 2017 version of my course. The current version of the book, Version 1.2, makes more corrections, but the major change is that the chapter on three.js has been updated to use Release 89 of three.js.
The home web site for this book is http://math.hws.edu/graphicsbook. The page at that address contains links for downloading a copy of the web site and for downloading PDF versions.
This is a free textbook. You are welcome to redistribute it, as long as you do not charge for it. You can make and distribute modified versions (including translations), as long as your version makes the original source clear and is distributed free of charge. (Officially, the book is licensed under a "Creative Commons Non-Commercial Attribution Share-Alike License.")
Many of the sample programs for this book are actually Web pages meant to be viewed in a Web browser. The Web version of this book includes interactive demo programs that are integrated into the Web pages that make up the book.
The sample programs and demos use HTML canvas graphics (in Chapter 2) or WebGL (in later chapters). Canvas graphics should work well in almost any modern browser. WebGL is a newer technology and is more problematic. It is implemented in all modern desktop browsers. It also runs in many browsers on newer mobile devices. However, each of those browsers have had some problems with some of my programs on some machines. Firefox and Chrome seem to work most consistently. I wish I could be more definite than that, but the reality of WebGL at this point is that you might have to look for a combination of computer and browser that will work for you.
The sample programs and demos can all be found in the download of the web site version of this book, which is available from its main page . Look for them in the folders named source and demo. Note that some Web browsers won't use images from the local file system in canvas and WebGL graphics. Those browsers will have errors when they try to run some of the samples locally instead of over the Web. For me, Firefox can run such examples. This issue affects only some of the examples.
I have taught computer graphics every couple of years or so for almost 30 years. As the field developed, I had to make major changes almost every time I taught the course, but for much of that time, I was able to structure the course primarily around OpenGL 1.1, a graphics API that was in common use for an extended period. OpenGL 1.1 supported fundamental graphics concepts in a way that was fairly easy to use. OpenGL is still widely supported, but, for various reasons, the parts of it that were easy to use have been officially dropped from the latest versions (although they are in practice supported on most desktop computers). The result is a much more powerful API but one that is much harder to learn. In particular, modern OpenGL in its pure form does not make for a good introduction to graphics programming.
My approach in this book is to use a subset of OpenGL 1.1 to introduce the fundamental concepts of three-dimensional graphics. I then go on to cover WebGL—a version of OpenGL that runs in a web browser—as an example of the more modern approach to computer graphics. While OpenGL makes up the major foundation for the course, the real emphasis is on fundamental concepts such as geometric modeling and transformations; hierarchical modeling and scene graphs; color, lighting, and textures; and animation.
Chapter 1 is a short overview of computer graphics. It introduces many concepts that will be covered in much more detail in the rest of the book.
Chapter 3 and Chapter 4 cover OpengGL 1.1. While OpenGL 1.1 is fairly primitive by today's standard, it includes many basic features that are still fundamental to three-dimensional computer graphics, in a form that is an easier starting point for people new to 3D graphics. Only part of the API is covered.
Chapter 6 and Chapter 7 cover WebGL, a modern version of OpenGL for graphics on the Web. WebGL is very low-level, and it requires the programmer to write "shader programs" to implement many features that are built into OpenGL 1.1. Looking at the implementation is an opportunity to understand more deeply how computers actually make 3D images.
And Chapter 8 looks briefly at some advanced techniques that are not possible in OpenGL.
Professor David J. Eck
Department of Mathematics and Computer Science
Hobart and William Smith Colleges
300 Pulteney Street
Geneva, New York 14456, USA