A minimal working example of an OpenGL program using GLEW, GLM and freeglut.
Note that the code is written in a way to prefer clarity in presentation over performance in the execution or good codding patterns.
Some of the features:
- All the code in a single source file.
- Print the OpenGL context info and libraries version to the console.
- Creates an OpenGL debug context to print OpenGL related error to the console.
I tested the sample in an Ubuntu 18.04 standard installation. It also requires your graphics drivers already installed. And then, I installed all the libraries from the official repositories.
In such scenario the sample is build with a single command line:
g++ -std=c++11 -Wall triangle.cpp -o triangle -lGLEW -lGL -lglut -lm
If your program builds, but crashes at execution, it is very likely that you do not have the required version of OpenGL. In that case you want to edit (or even comment) the context creation lines to match you current software.
