PistonDevelopers/opengl_graphics — pull request #111 by cybergeek94 (2014-12-20 15:03:53+00:00)
Title: Assert that OpenGL function pointers are loaded

Closes #59.

Coincidentally, this *will* cover the case where OpenGL was improperly loaded and the software fallback was returned, since the fallback is often the pre-2.0 fixed pipeline and will have none of the functions that should have actually been loaded. According to the specs, `glEnable` should be available in OpenGL >= 2.0

I went the little extra mile to make sure the panic message looked nice in a terminal, including some newlines and whitespace to make it easily readable, and keeping the lines under 80 columns:
```
task '

' panicked at '
OpenGL function pointers must be loaded before creating the `Gl` backend!
For more info, see the following issue on GitHub:
https://github.com/PistonDevelopers/opengl_graphics/issues/103
', src/gl_back_end.rs:322
```
Gnome-Terminal hotlinks the URL, which is really neat. Otherwise it's pretty easily copyable.

The unit test I included is a little superfluous, it just makes sure the assert hits when the functions aren't loaded. I can remove it if need be.

I have tested this with `sdl2_window`, and the assert passes.