Pyglet, OpenGL 3.2 on OS X Lion

319 views
Skip to first unread message

T.J. Jankun-Kelly

unread,
Sep 6, 2011, 4:14:24 PM9/6/11
to pyglet-users
I've been wanting use test out some of the latest OpenGL 3.2 support
on my Lion MBP (last year's model). It is capable of 3.2 support.
However, I cannot seem to get 3.2 working.

I have pyglet from the hg trunk installed in a virtualenv (with a
fixed pythonw). Here is the simple pyglet code:

===
import pyglet

config = pyglet.gl.Config(major_version=3, minor_version=2,
forward_compatible = True)
window = pyglet.window.Window(config=config, visible=False)
print('OpenGL version:', window.context.get_info().get_version())
print('OpenGL 3.2 support:', window.context.get_info().have_version(3,
2))

window.close()
===

And, when I run it:


(gfx)[03:12 PM] tjk@omnia (~/Documents/teaching/graphics/src):
pythonw pyglet_ogl3.py
('OpenGL version:', '2.1 NVIDIA-7.4.10')
('OpenGL version:', False)


Pointers are appreciate.

TJK

Andreas Schiefer

unread,
Sep 7, 2011, 7:17:56 AM9/7/11
to pyglet...@googlegroups.com

On 06.09.2011 22:14:24 UTC+2, T.J. Jankun-Kelly wrote:
I've been wanting use test out some of the latest OpenGL 3.2 support
on my Lion MBP (last year's model). It is capable of 3.2 support.
However, I cannot seem to get 3.2 working.

I'm not a Mac developer, so I can't really help, but ...

config = pyglet.gl.Config(major_version=3, minor_version=2,
forward_compatible = True)
 
a quick look at the source suggests, that the config arguments for specifying the version are currently not used during context creation on Mac OS.
That means pyglet does not support OpenGL 3 context creation on Mac OS currently.

Maybe someone can figure out what is needed to create an OpenGL 3 context on Mac OS and write a patch for pyglet?

T.J. Jankun-Kelly

unread,
Sep 7, 2011, 4:32:50 PM9/7/11
to pyglet-users
On Sep 7, 6:17 am, Andreas Schiefer <andreas.schie...@gmail.com>
wrote:

> a quick look at the source suggests, that the config arguments for
> specifying the version are currently not used during context creation on Mac
> OS.
> That means pyglet does not support OpenGL 3 context creation on Mac OS
> currently.
>
> Maybe someone can figure out what is needed to create an OpenGL 3 context on
> Mac OS and write a patch for pyglet?

Hrm. Not being a Cocoa master, hopefully whomever was responsible for
the pyglet-cocoa branch could have a look. At least Apple provides the
code needed to bootstrap OGL3.2 in Lion:
http://developer.apple.com/library/mac/#samplecode/GLEssentials/Introduction/Intro.html

TJK

T.J. Jankun-Kelly

unread,
Sep 11, 2011, 5:32:16 PM9/11/11
to pyglet-users
I banged on this during the weekend and have it mostly working with
one issue: I have to disable the shadow window to get it to work. 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/
Conceptual/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html#//
apple_ref/doc/uid/TP40001987-CH216-SW12). To fix this globally would
require doing something like adding a "shadow profile" option that
would be used by the shadow window.

I created an issue here to follow this patch:
http://code.google.com/p/pyglet/issues/detail?id=532&colspec=ID%20Status%20Type%20Milestone%20OpSys%20Summary

Adam Griffiths

unread,
Sep 16, 2012, 1:20:22 PM9/16/12
to pyglet...@googlegroups.com
Any further progress on this?
I integrated your patch into my Pyglet tree and I get a segfault when running the 3.2 test harness.
I'm using Mountain Lion.

I did notice a few changes to the cocoa.py file since your patch, but they look harmless.

Cheers,
Adam

T.J. Jankun-Kelly

unread,
Sep 17, 2012, 4:32:53 PM9/17/12
to pyglet...@googlegroups.com
AFAIK, the patch was never officially integrated (though there looks to be activity now). I hacked together something that worked for me at the time a year ago so I could teach my class; I cannot profess a deep understanding of the OS or pyglet internals (thus the note that someone more experienced in either could fix the issues I could not).

TJK

Adam Griffiths

unread,
Sep 17, 2012, 9:15:39 PM9/17/12
to pyglet...@googlegroups.com
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

Adam Griffiths

unread,
Sep 19, 2012, 8:13:55 AM9/19/12
to pyglet...@googlegroups.com
Even with the patch, pyglet is far from Core clean.
Legacy profile calls are embedded in a number of places.
Labels, vertex_list, etc, all call legacy functions.
Seem's that there's a bit of work to be done =P
Reply all
Reply to author
Forward
0 new messages