Fix build with Mesa 10

These commits fix build failures when compiling with recent Mesa 10 (OpenGL) due to discrepancies between GL/gl.h and glext.h.
Fix issue #461.