A downloadable book

Buy Now$6.50 USD or more

(ePub and MOBI formats)

This book is a practical guide to starting 3d programming with OpenGL and shaders, using the most recent version. It would suit anyone learning 3d programming that needs a practical guide with some help for common problems. The material is often used in this way by university courses and hobbyists.

This book is a collection of worked-through examples of common real-time rendering techniques as used in video games or student projects. There are also some chapters or short articles for Tips and Tricks - not-so-obvious techniques that can add a lot of value to projects or make it easier to find problems. The idea is to be something like a lab manual - to get you going and over the trickier and more confusing hurdles presented by the API.

Page Count: 454 approx. (varies with device)
Word Count: 111,000
Source Code: 40 demonstration programmes
Illustrated: Full-colour hand-drawn diagrams and screen-captures
Home-page and sample chapters: antongerdelan.net/opengl

Table of Contents

Introduction

  • Preface
  • Downloading and Compiling Demo Source Code

Basics

  • "Hello Triangle" - OpenGL 4 Up and Running
  • Extended Initialisation
  • OpenGL 4 Shaders
  • Vertex Buffer Objects

Transformation

  • Vectors and Matrices
  • Virtual Camera
  • Quaternion Quick-Start
  • Ray-Based Picking

Lighting and Texture Maps

  • Phong Lighting
  • Texture Maps

Tips and Tricks

  • Screen Capture
  • Video Capture
  • Debugging Shaders
  • Gamma Correction
  • Extension Checks and the Debug Callback
  • Uniform Buffer Objects and Mapping Buffers

Mesh Files

  • Importing a Mesh File

More Advanced Lighting and Texture Effects

  • Multi-Texturing
  • Using Textures for Lighting Coefficients
  • Fragment Rejection
  • Alpha Blending for Transparency
  • Spotlights and Directional Lights
  • Distance Fog
  • Normal Mapping
  • Cube Maps: Sky Boxes and Environment Mapping

New Shader Stages

  • Geometry Shaders
  • Tessellation Shaders

2d Rendering

  • 2d GUI Panels
  • Sprite Sheets and 2d Animation
  • Bitmap Fonts
  • Making a Font Atlas Generator Tool

Animation

  • Particle Systems
  • Hardware Skinning Part 1: Bones
  • Hardware Skinning Part 2: Skeleton Hierarchies
  • Hardware Skinning Part 3: Key-Frame Animation

Multi-Pass Rendering

  • Switching Framebuffer
  • Image Processing with a Kernel
  • Colour-Based Picking
  • Deferred Shading
  • Texture Projection Shadows

Discussion

  • Building Larger Programmes
  • Closing Remarks, Future Techniques, and Further Reading

You can also find the book on Amazon if you prefer to have it in your Amazon library.

Please let me know if you find a mistake or e-book format problem, and I will update it.

StatusReleased
CategoryBook
Release date Jun 25, 2014
Rating
Rated 4.8 out of 5 stars
(8 total ratings)
AuthorAnton Gerdelan
Tagsbook, computer-graphics, opengl, programming, Shaders, tutorials
Average sessionA few hours
LanguagesEnglish

Purchase

Buy Now$6.50 USD or more

In order to download this book you must purchase it at or above the minimum price of $6.50 USD. You will get access to the following files:

Anton's OpenGL 4 Tutorials [epub] ed 7 18 MB
Anton's OpenGL 4 Tutorials [mobi] ed 7 10 MB

Comments

Log in with itch.io to leave a comment.

Hello Anton,

While I was looking for a book on OpenGL on Amazon, I noticed that yours was the highest ranked book, congratulations and from there I came here.

In your book do you touch upon the mathematical backgrounds of computer graphics (how the perspective projection matrix is formed, etc.)?

Also, I couldn't see the Shadows topic in the content section. Is there shadow topic in the book too?

Thanks in advance.

(1 edit)

Hi nelzy!

Yes to both questions - here is the table of contents https://antongerdelan.net/opengl/book_TOC.html

You might also find this useful (or making your own as you go) https://antongerdelan.net/teaching/3dprog1/maths_cheat_sheet.pdf

Here is the latest version of my own maths library (an older version is built up in the book). I'd highly encourage everyone to build up (and test/compare) their own mini maths library code as you go  - best way to learn the mathematics.  https://github.com/capnramses/apg/tree/master/apg_maths

Reference code from the book is here https://github.com/capnramses/antons_opengl_tutorials_book - which might give you a preview of the shadows and transformations.

Since the book is older now - more up-to-date tips:

* Default to starting with 'OpenGL 4.1 Core' - that should work on most machines these days. You'll see this as 3 separate calls to 'window hints' to give before opening a window/context with the GLFW library.
* I think it mostly holds up over time. You might find some of the build instructions need an update - I've made some updates to the `ReadMe.md` on GitHub to help there, and I have some open Issues to update it further when I have time. Ignore any older 32-bit build stuff, of course.
* If I were to write it again now I wouldn't use C++ at all - just C since it's a C API (graphics was almost all C++ at the time).
* The most common cause of issues in new OpenGL users is make programs comprised of lots of classes  that don't reflect how the OpenGL global state works, so I'd encourage sticking to C functions that are easy to follow the flow of control and debug OpenGL state changes.
* Please overlook any cringe comments that I wrote in 2011!

hope that helps!
Anton

Thank you for the information. I'll review the book.

(1 edit)

Dear Anton, I'm an experient programmer from Russian Federation. Mainly embedded systems, microcontrollers, FPGA, etc. But new in 3D, which want now to master. I very like your bool, it is most usefull I can find in internet. Fitst of all don't know, how can buy it oficially. Payments from Russia not works now. I find your book on one "pirates bay", but want to buy. The second question. Anton, tell me please, can I to translate your book to Russian and place in internet for free ??? There is very few books about OpenGL in Russian. The best Russian autor is Alex Boreskov. But his books was published before 2006. Stone age for OpenGL ! So your book Russian translation will be a great gift for our developers community. Am I allowed to do it ???

Regards, Eugene.

(+1)

Hi Eugene,

Thanks for the compliment on the book! I'm not sure about payments from Russia. I understand many companies have blocked sales/presence. Right now the book is on Itch and Amazon. Do you know of other sites/payment options/purchase method that allow purchases?
I haven't done any translations, but that's an interesting idea - probably more for future work than for this book, since it's pretty old now.
Unfortunately I can't authorise an unofficial translation because that would put my copyright at risk.

If you're looking for a completely free alternative - check out https://learnopengl.com/. There is also a Russian translation.  The tutorials there have gotten pretty extensive. There wasn't much online anywhere for OpenGL 4 when I wrote mine. I think the only extra recommendation I would make is to write your own mathematics functions, rather than using a library. You can build up a library slowly, and it really helps to understand the mathematics. Here is a cheat-sheet I wrote many years ago https://antongerdelan.net/teaching/maths_cheat_sheet.pdf

I hope that _somewhat_ helps! Best of luck with adventures in 3D graphics!

Anton

Thanks for great book. 

I like how you use diagrams for better understanding. Some books trying to teach complex thing only with letters. but we can understand much better with visual material.

Dear Anton, I'm trying to pay with my european card but this stupid website tracks my geo ip (I'm currently on vacation) and detect the "mismatch" and just denies me make a purchase (says something about VAT regulation). Stupid people assume I shouldn't buy a book while traveling another country? What about digital nomads? Hey itch.io creators, are you out of your mind? this is faschism

I finally managed to buy a book. Just set the billing address to my current country.

But, hey, itch.io, this is really WEIRD. Its 21th century now and people could live and travel abroad freely. Open borders, don't close them. Especially the digital ones. I really really don't understand this

i believe its just to comply with tax laws in different countries. europe recently changed to pay-at-origin-of-buyer rather than seller, for example, so they need to know where you are to figure out where to send the sales tax.

Cool. Still have not purchased my new system and with the nvidia 10X0 announce I am glad I waited. I know I do not need that much performance, and for a while I considered buying a cheap system just to get started. But a decent cheap laptop is $700, and for a little more than twice that I can get something that will last a while. Currently considering Asus and hoping to get a laptop with a GTX1070. My goal is to order by the end of June. I am as excited about the learning as I am about getting a new system. This time next year I want to be game programming and to understand what I am doing completely. P.S: You would get more feedback if you were on facedbook, but none of it would be from me. PS2: Are you getting up to speed on Vulkan? I want to be a capable OpenGL programmer before I consider it, so it is more than a year away for me.

My friend Andrea set up a facebook page over here: https://www.facebook.com/AntonsOpenGL/. I believe it's mostly just a traffic director as it gets a few hits but not comments! I haven't looked at Vulkan yet. I want to see how it catches on across different operating systems and if there's interest in the indie/student area first. I think my next project will be dissecting my video game with some videos/tutorial type stuff as there seems to be plenty of interest there. I'm just finishing the Steam build at the moment. Good luck.

End of June. Right. I helped a friend move ($$) to California, which put a hold on a lot of things. I am looking forward to getting started on this. With ASUS announcing the new laptops with gtx1070 graphics, I believe the wait will be worth it. I expect to place my order within 4 weeks, so starting the book around the end of September is a more realistic time frame. I will be purchasing some games to get an idea of what the OpenGL game capabilities are as I would eventually like to participate in a gamejam.

(2 edits)

I uploaded edition 7, which fixes previously listed errata (http://antongerdelan.net/opengl/book_info.html), and has better general advice sections in the Preface and Extended Init chapter.

I've also put a Compute Shaders extra tutorial on my website http://antongerdelan.net/opengl/

The 'antongerdelan' site indicates the book can be read on this (itch) site, but I have yet to find the associated link. If there was a PDF version of the book I would buy it.

(1 edit)

hi dot(n,l)!

the only on-line reader browser app is Amazon's cloud service - perhaps i misworded something on my website? i would like to have a PDF but i don't at the moment.

short story: it's too much work to get it to format to the same standard.

long story: i painted myself into a corner a little. the book started as a little experiment with self-publishing on amazon and i never expected it to be so popular! the original is in a [not very pleasant] subset of HTML that amazon's kindlegen tool required in an early version (this is also why there are no properly-formatted tables). it was not too much trouble to convert that to a nice epub and mobi, but of the pdf conversion tools i've tried the formatting of layout things like margins and table of contents is not to a high enough standard and/or it takes too long. i had a foray into making a tool that would reformat all the HTML into the equivalent LaTeX but it also ended up taking too long to justify [pun intended]. certainly, it's possible to use something like Calibre to convert the epub to a pdf if you like, but you'll see it's not quite formatted well enough for me to upload as a finished product! i'll take any suggestions for a better/quicker conversion pipeline that people can throw at me!

Well, given the time you have put into considering the different formats I do not think investing more time in the PDF version would be worthwhile. I will be getting the epub version as soon as I get off work. Thanks for the reply and I am looking forward to the book.

Purchased the book without any issue. What drew me to the book was your comments on the 'standard' texts, and I am glad to hear someone else ask, 'is this a good way to learn?" I started and stopped my learning more than once using the superbible book, and I have a degree so I am not a dummy. Based on your comments and my brief review of some pages in your book, I believe after reading your book I could pick up a CG text (e.g. Shirley) and implement a concept or piece of pseudo code being discussed. So, the adventure begins.

(2 edits)

will redo the bit about shader parallelism at some stage - it's trying to be too specific in relating # of parallel shader executions to # of uniform shader cores. should be a looser relationship - reported # of shader 'cores' are massively over-inflated by manufacturers

done! the current version should include these changes and a better overview image in the Shaders chapter.

(1 edit)

I uploaded ed 5, fixing errors in angle calculations in the Spotlights chapter, and various typos. Please let me know if there has been a mistake in the builds and I shall build them again!