Skip to main content

OpenGL: how to start studying?

I've been studying OpenGL for about 2 years, but I haven't got far with it and had no idea what is wrong. Is it me unable to understand OpenGL abstractions or is it designed not very well? I was looking for an answer all these years when suddenly I've started getting into math since my job required some math skills and suddenly OpenGL started to make sense for me. I ain't trying to say that now it's fun and games - honestly I find it challenging, but not as bad as before.



So math resolved some frustrating moments for me, just as improvements in English (after all it's still secondary language and I still have a lot to learn) made it possible to read original sources of info (about which I'm going to write later) and my overall growing as developer allowed me to get back to OpenGL and beat the challenges I had previously.

There are many books about the subject covering all possible platforms that support OpenGL. I'm not focusing on all possible variations of a platform/OS pairs, but instead I'm learning it on old good PC. You should do the same if you want to learn it good enough to write code that will do a task you want it to. No wasting time.

So for many years I was hearing about few main books on OpenGL.


OpenGL Superbible which often called The Blue book. Which looks more as a printed out documentation of functions used to manipulate OpenGL contexts. Contains few samples here and there, but has a lot more downloadable examples. The book shows you some functions and provides a context of using those to achieve some results. Great for experienced developers to renew knowledge or find additions between previous versions of OpenGL.


OpenGL Programming Guide - The Red book. I just started reading this one, but so far I like it better. As you can decipher from it's name - it provide guide following which you will easily get some things about OpenGL. Has in-book samples as well as downloadable ones. So requires you to know how to setup your environment, knowledge of cmake and C++, to be able to work with the samples. Perfect for me, but sometimes too challenging even for me. You should know how to deal with such problems if you want to learn OpenGL no matter which platform you want to use.

Setting thing up gonna be a little problematic, but I'm gonna try to instruct you with list of simplified steps. You still need to learn what you do and why it needs to be done in order to fill free of it and focus on studying. It would be a shame to drop it because of some problems within building code, wouldn't it?

To start the process you will need to install some utilities. Let's define that we're trying to build samples and our own project on a Windows family system.

  1. Download and install Visual Studio of desired version.
  2. You need cmake to create project files.
  3. As well in order to download samples you need git.
  4. Here is the repository with samples. Get it with git.
  5. After that run cmake. It needs you to input working directory and directory where the project files will be stored.
  6. Click Generate button and it will create the blank project. After that setup dependency directories and desired flags. Usually on this step I just update some dependencies with paths to it's folders and let it Configure the project.
  7. After that you will have the VS project which will be set up with all dependencies and flags you've chosen in cmake.
  8. Try to build the project. It can produce some errors - I had one that required me to retarget all the subprojecs.
  9. Chose one subproject and fix all errors that it produces. If you did previous steps correctly there won't be too much of them.
  10. On that point you should have a working sample. Applying same algorithm to other samples you will eventually will have all them built up.
I'm going to end the article on that point. Later I'll setup my own project and be able to play with some OpenGL 4.5 code.

Popular posts from this blog

Templates and how to fold them

Variadic templates appeared in C++11 to cover such cases when you would have a template functions that could have a numerous members of different types. Doesn't it remind you of variadic functions that uses va_start, va_arg, va_end and so others? Cause it should be.


Tuples: are they useful?

In some languages there is such a thing as tuple which makes real to write such code (this time it's in python):


def f(x):
 # do stuff return (True, modified_string)

success, modified_string = f(something) 
C++ hadn't such feature until C++11. That was one of the reasons to pass variable as referenced argument, which ended up creating huge code bases that have unused arguments in it's functions. That happened in order to save revers compatibility and allow clients to use stable interfaces to access libraries without checking the version of dynamically attached library in order to use correct functions.