def set_active_context(self): """Store information for the currently active context. This method is called automatically for the default context. """ self.have_context = True if not self._have_info: self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value) self.renderer = asstr(cast(glGetString(GL_RENDERER), c_char_p).value) self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value) if self.have_version(3): from pyglet.gl.glext_arb import glGetStringi, GL_NUM_EXTENSIONS num_extensions = GLint() glGetIntegerv(GL_NUM_EXTENSIONS, num_extensions) self.extensions = (asstr(cast(glGetStringi(GL_EXTENSIONS, i), c_char_p).value) for i in range(num_extensions.value)) else: self.extensions = asstr(cast(glGetString(GL_EXTENSIONS), c_char_p).value).split() if self.extensions: self.extensions = set(self.extensions) self._have_info = True
def set_active_context(self): '''Store information for the currently active context. This method is called automatically for the default context. ''' self.have_context = True if not self._have_info: self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value) self.renderer = asstr(cast(glGetString(GL_RENDERER), c_char_p).value) self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value) if self.have_version(3): from pyglet.gl.glext_arb import glGetStringi, GL_NUM_EXTENSIONS num_extensions = GLint() glGetIntegerv(GL_NUM_EXTENSIONS, num_extensions) self.extensions = (asstr(cast(glGetStringi(GL_EXTENSIONS, i), c_char_p).value) for i in range(num_extensions.value)) else: self.extensions = asstr(cast(glGetString(GL_EXTENSIONS), c_char_p).value).split() if self.extensions: self.extensions = set(self.extensions) self._have_info = True