odyaka341 / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

No Core Profile support on OS X 10.7 Lion with 1.2dev #532

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install Lion on any hardware capable of OpenGL 3.2 support (up year old 
machines)
2. Get pyglet from source
3. Run the attached code.

Output will be 
  ('OpenGL version:', '2.1 NVIDIA-7.4.10')
  ('OpenGL 3.2 support:', False)
Even though 3.2 is supported.

After looking into the issue, I have created a patch which mostly solves the 
issue (attached). Unfortunately, one has to disable the shadow_window in order 
for this to work as the shadow window creates a default context (with a Legacy 
Profile); when a Core Profile is created afterwards, OS X complains that it is 
an invalid share as they are different profiles 
(http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptua
l/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html#//apple_ref/doc/uid/T
P40001987-CH216-SW12). To fix this globally would require  doing something like 
adding a "shadow profile" option that would be used by the shadow window.

Hopefully someone can determine what to do about the shadow_window (if a 
consensus is reached).

Original issue reported on code.google.com by tjjankun...@gmail.com on 11 Sep 2011 at 9:29

Attachments:

GoogleCodeExporter commented 8 years ago
Winston will take a look after we've made a release candidate.

Original comment by winstonw...@gmail.com on 17 Jun 2012 at 5:01

GoogleCodeExporter commented 8 years ago
I've skimmed through your patch.
Could you provide some more explanation as to why you've modified what you have?

I've implemented a slightly modified version and it segfaults on Mountain Lion.

Original comment by adam.lw....@gmail.com on 16 Sep 2012 at 9:34

GoogleCodeExporter commented 8 years ago
I've pushed my changes to my pyglet repo

https://github.com/adamlwgriffiths/Pyglet
https://github.com/adamlwgriffiths/Pyglet/commit/25a2f2aa6adc8fd15822ed15b817cab
46177efba

Original comment by adam.lw....@gmail.com on 17 Sep 2012 at 6:54

GoogleCodeExporter commented 8 years ago
I tracked the segfault down to this line:

profile = self._pixel_format.getValues_forAttribute_forVirtualScreen_(
                None,
                NSOpenGLPFAOpenGLProfile,
                0
                )

Original comment by adam.lw....@gmail.com on 17 Sep 2012 at 8:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok, I fixed it by changing the None parameter to match the other calls to 
getValues_forAttribute<snip>...

Ie
vals = c_int()
profile = self._pixel_format.getValues_forAttribute_forVirtualScreen_(
                byref(vals),
                NSOpenGLPFAOpenGLProfile,
                0
                )

Commit is located here:
https://github.com/adamlwgriffiths/Pyglet/commit/48500c8c520f6884fca6f7eb5e369f0
fd63c8bc6

I also did some other modifications to clean up previous patch:

Simplify the OS-X version / GL profile checking code
https://github.com/adamlwgriffiths/Pyglet/commit/b09339cb0d97563177cf147c2e448d3
e48dd201e

Remove the 'forward_compatible' which the patch forced. This isn't needed.
https://github.com/adamlwgriffiths/Pyglet/commit/05b7e97e1cae2efeed14ca8fbac1170
2e799e0a0

Original comment by adam.lw....@gmail.com on 17 Sep 2012 at 8:37

GoogleCodeExporter commented 8 years ago
As I said elsewhere, this was bodged together to get it to work for Lion: I 
noticed that the shadow window needed to be the same profile (the first profile 
created locked whether or core or compatibility profile is possible; all others 
created by pyglet seem to use the same type); also noticed some constants were 
missing from the OS X wrappers for creating the Core profile.

My understanding of pyglet and OS X internals were (and still are) incomplete, 
and I haven't looked at either in a year. But you asked for context (no pun 
intended), and there it is. :)

TJK

Original comment by tjjankun...@gmail.com on 17 Sep 2012 at 8:37

GoogleCodeExporter commented 8 years ago
Thanks for the info.
I don't expect it to be integrated. I don't have a good understanding of 
either, but it seems the shadow window needs to be dealt with properly somehow.
This is a good start for the Core 3.2 support though.

Cheers,
Adam

Original comment by adam.lw....@gmail.com on 18 Sep 2012 at 1:16

GoogleCodeExporter commented 8 years ago

Original comment by Adam.JT...@gmail.com on 6 Dec 2012 at 8:56

GoogleCodeExporter commented 8 years ago
I have updated the patch to go against the latest from 1.2alpha 1. It allows 
Core Profile to be used and incorporates the changes from Adam. 

Full repository: https://github.com/infowantstobeseen/pyglet-darwincore
Patched files: 
https://github.com/infowantstobeseen/pyglet-darwincore/commit/b27f3915f938a21c98
2420051db37efc0e7650ae 

Original comment by tjjankun...@gmail.com on 27 Jul 2013 at 3:45

GoogleCodeExporter commented 8 years ago
Tjjankun's above patch works on Mavericks (10.9) with pyglet 1.2alpha1 
[gl_info.get_version(): 4.1 NVIDIA-8.18.22 310.40.05f01]. However, since OS X 
only implements a core profile, most of pyglets convenience functions (labels 
for example) stop working and it's necessary to overwrite the on_resize method 
of pyglet.window.Window as well, but for folks that just want raw OpenGL 
access, this works.

Original comment by efairlight on 18 Nov 2013 at 8:25

GoogleCodeExporter commented 8 years ago

Original comment by useboxnet on 30 May 2014 at 6:12

GoogleCodeExporter commented 8 years ago
Does this bug go away if pyglet.options['shadow_window'] == False?

Original comment by Adam.JT...@gmail.com on 2 Jun 2014 at 10:06

GoogleCodeExporter commented 8 years ago
I don't know, I don't have a Mac for testing.

Original comment by useboxnet on 3 Jun 2014 at 5:37

GoogleCodeExporter commented 8 years ago
I manually disable the shadow window in all my code for darwin via that flag, 
but a user that does not know they have to disable it will get problems.

Original comment by tjjankun...@gmail.com on 3 Jun 2014 at 8:54