def pullExtensions( self ): from OpenGL import platform if not platform.PLATFORM.CurrentContextIsValid(): return False from OpenGL.raw.GL._types import GLint from OpenGL.raw.GL.VERSION.GL_1_1 import glGetString, glGetError from OpenGL.raw.GL.VERSION.GL_1_1 import GL_EXTENSIONS from OpenGL import error try: extensions = glGetString( GL_EXTENSIONS ) if glGetError(): raise error.GLError() if extensions: extensions = extensions.split() else: return False except (AttributeError, error.GLError): # OpenGL 3.0 deprecates glGetString( GL_EXTENSIONS ) from OpenGL.raw.GL.VERSION.GL_3_0 import GL_NUM_EXTENSIONS, glGetStringi from OpenGL.raw.GL.VERSION.GL_1_1 import glGetIntegerv count = GLint() glGetIntegerv( GL_NUM_EXTENSIONS, count ) extensions = [] for i in range( count.value ): extension = glGetStringi( GL_EXTENSIONS, i ) extensions.append( extension ) # Add included-by-reference extensions... version = self.getVersion() if not version: # should not be possible? return version check = tuple( version[:2] ) for (v,v_exts) in VERSION_EXTENSIONS: if v <= check: for v_ext in v_exts: if v_ext not in extensions: extensions.append( as_8_bit(v_ext) ) else: break return extensions
def pullExtensions( self ): from OpenGL import platform if not platform.PLATFORM.CurrentContextIsValid(): return False from OpenGL.raw.GL._types import GLint from OpenGL.raw.GL.VERSION.GL_1_1 import glGetString, glGetError from OpenGL.raw.GL.VERSION.GL_1_1 import GL_EXTENSIONS from OpenGL import error try: extensions = glGetString( GL_EXTENSIONS ) if glGetError(): raise error.GLError() if extensions: extensions = extensions.split() else: return False except (AttributeError, error.GLError) as err: # OpenGL 3.0 deprecates glGetString( GL_EXTENSIONS ) from OpenGL.raw.GL.VERSION.GL_3_0 import GL_NUM_EXTENSIONS, glGetStringi from OpenGL.raw.GL.VERSION.GL_1_1 import glGetIntegerv count = GLint() glGetIntegerv( GL_NUM_EXTENSIONS, count ) extensions = [] for i in range( count.value ): extension = glGetStringi( GL_EXTENSIONS, i ) extensions.append( extension ) # Add included-by-reference extensions... version = self.getVersion() if not version: # should not be possible? return version check = tuple( version[:2] ) for (v,v_exts) in VERSION_EXTENSIONS: if v <= check: for v_ext in v_exts: if v_ext not in extensions: extensions.append( as_8_bit(v_ext) ) else: break return extensions