The comment block at the top of gl3.h reads as follows:
* It is not possible to #include both <GL3/gl3.h> and either of
* <GL/gl.h> or <GL/glext.h> in the same source file.
However, it is in fact possible to include both gl3.h and gl.h, at least on Windows. If both are included, then use of deprecated GL commands (such as glPushAttrib()) doesn't generate a compile error.
To protect against including both files, gl3.h could add an additional CPP include guard. Currently, gl3.h has this:
But we'd need to add another guard to protect against includeing both headers:
This would prevent both gl3.h and gl.h from being included. If the user's source code included gl.h first, then gl3.h would be skipped; if the source included gl3.h first, then gl.h would be skipped.
As an alternate fix, the comment block at the top of gl3.h could be clarified to state that it is technically possible to include both headers, but this should be avoided.
It is also possible that this is merely a Windows-specific issue, in which case I apologize for wasting your time. :-)
(Note that glu.h typically includes gl.h indirectly, so the list of files that should not be included with gl3.h should also include glu.h.)
Please replace all uses of "gl3.h" with "glcorearb.h". Thanks.
> As an alternate fix, the comment block at the top of gl3.h could be
> clarified to state that it is technically possible to include both
> headers, but this should be avoided.
This is basically what I've done in the new headers generated from
the new XML API Registry. I tend to shy away from fancy preprocessor
tricks because I don't really know what sort of compilation environments
people are using or what sort of tricks they might be playing around
inclusion of the Khronos headers.