This book has one goal - to help you pass a one-term computer graphics course at university that uses OpenGL for the practical side. We will learn OpenGL, master all your assignments, manage your time, and pass the exam. And no more. Specifically:
If you're a graphics student, perhaps in your final year of a bachelor's degree, and seriously concerned about squeezing a very difficult but fun course into an overwhelming term then worry not - this, my second OpenGL text, is devoted entirely to you, the most under-served and highest potential contributors to computer graphics. I assume that the reader is typical of one of my students. I have lectured computer graphics at two universities now so I have a pretty good idea of what's required. If you're not a student, you might find that this is, in any case, a nice way to get started from a similar background.
My previous book - Anton's OpenGL 4 Tutorials - was a very successful experiment with e-book publishing in 2014. At the time there wasn't much to go on for learning how to use the latest version of the OpenGL graphics interface. The official texts were out of date. Websites were a minefield of muddled new and old standards. It was hard to know where to start - especially for students. The whole computer graphics programming field has a bit of an insider veterans-only feel to it which can be pretty intimidating for mere mortal students and newcomers. I know this because I had to learn it all myself in a huge hurry for teaching during 2011. I had done graphics programming before, but nothing with shaders. I spent probably several hundreds of hours helping students in graphics programming labs, which made me really very good at explaining concepts in a sensible way, and how to diagnose problems and frustrations with helpful diagrams. All of this extra experience went into the first book and I think that's what people appreciated. Nothing can seem as hopeless to a deadline-loaded student as the dreaded Black Screen of Doom, but there are strategies to fixing all of these all-too-common-problems - something other texts never seem to think is important to discuss.
The first book is a bit older now. We have new tools and new standards to talk about, and I have another two years of experience to impart. I think the first book probably tried to cover too much material, and too many techniques in one volume. So this book is more concise, focused, and up to date. I considered looking at other, newer APIs, but actually it seems like most college courses are still based on OpenGL but have shifted to the newer versions, so I think that this topic still has the most traction.
I know that a good quarter of any fourth-year engineering or computer science class has somehow made it through whilst secretly being terrible at programming. I also know that, despite having a good background in vectors, matrix maths, and perhaps physics, that actually using these concepts in a real application presents a new challenge. I have thought about all of these things whilst preparing this text. I'm not just going to show you how to learn OpenGL programming and the concepts behind it in one hell of a short time budget, but I'm going to show you how to track your progress and prioritise your learning to get up to speed over what will be one term only. I'll tell you what the time-sinks are to put on low priority. That great black wall of stress where you actually don't know if you have enough time gets a lot easier when someone who has done it before can help you plot what needs to be done into a calendar - then you are in control again.
I know students tend to work on a bit of a mix of hardware - official lab machines, and a motley mix of laptops and home desktops of various capability and make. It's ridiculous to not accommodate this - I'm going to introduce the very latest version of OpenGL as your primary reference, but I'll also show you how to run compatible versions on your own machines. It makes sense to use your own machine for assignments, even if it's an older Apple machine.
I explain the software engineering ideas that never seem to be explained - what is a nice way to match up the mesh you load from a file to OpenGL's weird objects? How do you manage all your shaders in a way conducive to working efficiently? I'm not going to force my own programming frameworks on you - I'll write in fairly neutral C, give you some suggestions, and you can make any sort of structure you like with it - I appreciate that students love to over-engineer things according to their preferences du jour!
If that wasn't already an excellent start - I'll also give you demonstration tips - how to bulletproof your code so that it runs on the day, steps to take to make sure that your assignments run on your professor's machine too, and I'll show you what to expect from a university computer graphics exam, explain the process of how they are constructed, and give you real exam questions with answers. All of the interviews with graphics programming companies (including the games industry) that I have seen so far will ask you to do a test - guess what - these are the same format as computer graphics exams and ask the same questions. You should be reasonably well prepared then.
This may be your first serious programming exercise where you get some visual feedback. You have a lot of power to leverage your creativity in this subject. I hope that you enjoy it as much as I do and that in your most difficult of year of study that this book helps save your bacon.
Dr Anton Gerdelan