These code changes are simply to get the OpenGL Core profile working on OS-X.
I believe it works on Windows / Linux (I just ran my core examples with no changes on Ubuntu).
I don't experience the problem with the window not showing, and these changes aren't aimed at that problem so I highly doubt these changes will help.
I don't expect them to be pulled verbatim into pyglet. But they work, so someone with more knowledge of the code base should be able to look into why they work and how to integrate it cleanly =)
OpenGL 2.1 and below are considered legacy and use the fixed function pipeline.
This was pre-shaders being core to opengl.
To get fancy effects you had to set a lot of state and do some tricky things with stencil buffers, etc to get opengl to do what you want.
Shaders changed that.
OpenGL 3 broke away from the fixed function by replacing almost _everything_ with shaders.
There is no matrix stack, no push / pop functionality. And you _need_ shaders to render _anything_.
It's a big change, and it breaks a lot of existing functionality.
So they implemented a compatibility mode... well... the vendors did.
So you can run fixed function logic along side core logic.
But OS-X doesn't seem to support this. At least from the way pyglet is running. I may be wrong.
OS-X also only supports either, 2.1 legacy, or 3.2 (OpenGL is up to 4 now).
So it's very.... strict.... for lack of a better word.
Pyglet already lets you select the opengl version you want in the gl config class that you pass to Window.
You use the major_version and minor_version (3,2 for core 3.2).
But on OS-X, this value is ignored. At least in vanilla pyglet. Hence the patch to read and process these.
The problem I have is that classes like Label and vertex_list use fixed function calls such as glPushClientAttrib, glPushAttrib.
These are (unfortunately) gone in the core profile.
The best way I can think of getting around it, is to either monkey patch the code, or add a tonne of 'if core_profile and pure' statements to avoid these calls. But that's pretty messy =/
I can get things rendering in the core profile, but only using pure opengl calls. The pyglet wrappers will cause gl exceptions due to unsupported functionality being used.
It's not a trivial job. Even in my project, trying to provide a single code path for legacy and core.... I just can't see one without scattering global variables all over the place to store matrix stacks and what not.
And that really defeats the purpose of the core profile.
Then there's also backward compatibility to think about. I don't think people would like it if they had to update existing code to keep it working.
It's pretty confusing =/
Cheers,
Adam