Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve consistency in how *GetCurrentContext calls are loaded and used #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenGL/GL/pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def glRenderMode( newMode ):
# Okay, now that the easy cases are out of the way...
# Do we have a pre-stored pointer about which the user already knows?
context = platform.GetCurrentContext()
if context == 0:
if not context:
raise error.Error(
"""Returning from glRenderMode without a valid context!"""
)
Expand Down
2 changes: 1 addition & 1 deletion OpenGL/contextdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def getContext( context = None ):
"""
if context is None:
context = platform.GetCurrentContext()
if context == 0:
if not context:
from OpenGL import error
raise error.Error(
"""Attempt to retrieve context when no valid context"""
Expand Down
4 changes: 3 additions & 1 deletion OpenGL/platform/darwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def GLE(self): return self.GLUT

@baseplatform.lazy_property
def GetCurrentContext( self ):
return self.CGL.CGLGetCurrentContext
CGLGetCurrentContext = self.CGL.CGLGetCurrentContext
CGLGetCurrentContext.restype = ctypes.c_void_p
return CGLGetCurrentContext

def getGLUTFontPointer( self, constant ):
"""Platform specific function to retrieve a GLUT font pointer
Expand Down
4 changes: 3 additions & 1 deletion OpenGL/platform/egl.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def GLE( self ):
DEFAULT_FUNCTION_TYPE = staticmethod( ctypes.CFUNCTYPE )
@baseplatform.lazy_property
def GetCurrentContext( self ):
return self.EGL.eglGetCurrentContext
eglGetCurrentContext = self.EGL.eglGetCurrentContext
eglGetCurrentContext.restype = ctypes.c_void_p
return eglGetCurrentContext

def getGLUTFontPointer( self, constant ):
"""Platform specific function to retrieve a GLUT font pointer
Expand Down
4 changes: 3 additions & 1 deletion OpenGL/platform/glx.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def GLE(self):
# really kosher...
@baseplatform.lazy_property
def GetCurrentContext(self):
return self.GLX.glXGetCurrentContext
glXGetCurrentContext = self.GLX.glXGetCurrentContext
glXGetCurrentContext.restype = ctypes.c_void_p
return glXGetCurrentContext

def getGLUTFontPointer(self, constant):
"""Platform specific function to retrieve a GLUT font pointer
Expand Down