Modern OpenGL in a single C file
I’ve lost count of the number of times I’ve wanted (and made) a simple, working OpenGL example in order to start off a project. It’s so often desirable to work on a project incrementally – to add new content in small bits, testing each small piece. This is all the more true for graphics programming where small mistakes can lead to the most frustrating thing of all: a blank window with no feedback as to what went wrong. This makes starting a project in modern OpenGL particularly difficult, since there is a good deal that you need to set up before you can see anything: view matrices, shaders, and VBOs are all necessary.
After some recent struggles (which turned out to be caused by a silly, non GL issue), I created this repository in order to have a simple, working, modern OpenGL example all in a single C file. It uses my prefered window and context creation library, GLFW, and extension loading library, GLEW. It also includes all of the matrix math necessary for perspective and look-at camera functions.
Now I only hope that I won’t need to use this file again.