According to OpenGL spec, a shader object will only be flagged
for deletion unless it has been detached; when a program object
is deleted, those shader objects attached to it will be detached
but not deleted unless they have already been flagged for deletion.
So we shall detach a shader object before it is deleted, and delete
it before the program object is deleted best.
We need to check on realize if we have access to a GL context, before
calling GL functions. We use gtk_gl_area_get_error() for that.
We also need to tear down the resources during unrealization, instead
of leaking them.
Make sure that variables are declared at the top of the block.
Break up one of the sincos() calls into individual calls to sin() and cos()
so that we do not have to complicate the initialization of the following
GLfloat array.
Instead of using glxgears, which still uses OpenGL 2.1 and the fixed
pipeline, we use a slightly modified es2gears, OpenGL 3.2, and the
programmable pipeline.
Its not really reasonable to handle failures to make_current, it
basically only happens if you pass invalid arguments to it, and
thats not something we trap on similar things on the X drawing side.
If GL is not supported that should be handled by the context creation
failing, and anything going wrong after that is essentially a critical
(or an async X error).