I've implemented some context managers here: https://github.com/adamlwgriffiths/PyGLy/blob/master/pygly/gl/legacy/__init__.py
Note the legacy module prefix. Also, be aware that using multiple context managers in a single with statement will result in undesired behavior due to the order that python unwinds them. Ie: with matrix_mode( GL_PROJECTION ), matrix( projmatrix ): pass Python unwinds in the same order it set (go figure), so the following will occur: matrix mode begins unknown matrix mode push - matrix mode now projection matrix push - matrix added to projection matrix stack matrix mode pop - projection mode popped from matrix mode, matrix mode unknown matrix pop - matrix popped from unknown matrix stack Cheers, Adam On Thursday, November 1, 2012 8:11:04 PM UTC+11, Mark wrote: > > Rather than writing: > > glBegin() > ... draw > glEnd() > > it would be nice to write: > > with glContext(): > ... draw > > > I know I can easily create my own glContext context manager, but it > just seems that it would be nicer built in. Or is there one and I just > haven't found it? > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To view this discussion on the web visit https://groups.google.com/d/msg/pyglet-users/-/sHHnGmjzVgEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
