Initialization
Before you can actually use OpenGL in a program, you must first initialize it. Because OpenGL is platform-independent, there is not a standard way to initialize OpenGL; each platform handles it differently. Non-C/C++ language bindings can also handle these differently.
2 phrases of OpenGL initialization:
-
The creation of an OpenGL Context
1 2 3
An OpenGL context represents all of OpenGL. Creating one is very platform-specific, as well as language-binding specific.
-
load all of the necessary functions to use OpenGL
1
2
3
4
5
6
7
8
If you are using a non-C/C++ language binding, then the maintainer of that binding will already handle this as part of context creation. If you are using C/C++, read on.
In order to use OpenGL, you must get OpenGL API functions.
For most libraries you are familiar with, you simply #include a header file, make sure a library is linked into your project or makefile, and it all works.
OpenGL doesn't work that way. you must manually load functions via a platform-specific API call. This boilerplate work is done with various OpenGL loading libraries; these make this process smooth.