Python pyglet.gl.Config() Examples
The following are 10
code examples of pyglet.gl.Config().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pyglet.gl
, or try the search function
.
Example #1
Source File: __init__.py From flappy-bird-py with GNU General Public License v2.0 | 6 votes |
def get_best_config(self, template=None): '''Get the best available GL config. Any required attributes can be specified in `template`. If no configuration matches the template, `NoSuchConfigException` will be raised. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: `pyglet.gl.Config` :return: A configuration supported by the platform that best fulfils the needs described by the template. ''' if template is None: template = gl.Config() configs = self.get_matching_configs(template) if not configs: raise NoSuchConfigException() return configs[0]
Example #2
Source File: __init__.py From flappy-bird-py with GNU General Public License v2.0 | 6 votes |
def get_best_config(self, template=None): '''Get the best available GL config. Any required attributes can be specified in `template`. If no configuration matches the template, `NoSuchConfigException` will be raised. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: `pyglet.gl.Config` :return: A configuration supported by the platform that best fulfils the needs described by the template. ''' if template is None: template = gl.Config() configs = self.get_matching_configs(template) if not configs: raise NoSuchConfigException() return configs[0]
Example #3
Source File: __init__.py From flappy-bird-py with GNU General Public License v2.0 | 6 votes |
def get_best_config(self, template=None): '''Get the best available GL config. Any required attributes can be specified in `template`. If no configuration matches the template, `NoSuchConfigException` will be raised. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: `pyglet.gl.Config` :return: A configuration supported by the platform that best fulfils the needs described by the template. ''' if template is None: template = gl.Config() configs = self.get_matching_configs(template) if not configs: raise NoSuchConfigException() return configs[0]
Example #4
Source File: base.py From pyglet with BSD 3-Clause "New" or "Revised" License | 6 votes |
def get_matching_configs(self, template): """Get a list of configs that match a specification. Any attributes specified in `template` will have values equal to or greater in each returned config. If no configs satisfy the template, an empty list is returned. :deprecated: Use :meth:`pyglet.gl.Config.match`. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: list of :class:`~pyglet.gl.Config` :return: A list of matching configs. """ raise NotImplementedError('abstract')
Example #5
Source File: viewer.py From gqn-dataset-renderer with MIT License | 6 votes |
def _init_and_start_app(self): from pyglet.gl import Config conf = Config(sample_buffers=1, samples=4, depth_size=24, double_buffer=True, major_version=OPEN_GL_MAJOR, minor_version=OPEN_GL_MINOR) super(Viewer, self).__init__(config=conf, resizable=True, width=self._viewport_size[0], height=self._viewport_size[1]) if self.context.config.major_version < 3: raise ValueError('Unable to initialize an OpenGL 3+ context') clock.schedule_interval( Viewer._time_event, 1.0 / self.viewer_flags['refresh_rate'], self ) self.switch_to() self.set_caption(self.viewer_flags['window_title']) pyglet.app.run()
Example #6
Source File: viewer.py From pyrender with MIT License | 6 votes |
def _init_and_start_app(self): from pyglet.gl import Config conf = Config(sample_buffers=1, samples=4, depth_size=24, double_buffer=True, major_version=OPEN_GL_MAJOR, minor_version=OPEN_GL_MINOR) super(Viewer, self).__init__(config=conf, resizable=True, width=self._viewport_size[0], height=self._viewport_size[1]) if self.context.config.major_version < 3: raise ValueError('Unable to initialize an OpenGL 3+ context') clock.schedule_interval( Viewer._time_event, 1.0 / self.viewer_flags['refresh_rate'], self ) self.switch_to() self.set_caption(self.viewer_flags['window_title']) pyglet.app.run()
Example #7
Source File: __init__.py From flappy-bird-py with GNU General Public License v2.0 | 5 votes |
def get_matching_configs(self, template): '''Get a list of configs that match a specification. Any attributes specified in `template` will have values equal to or greater in each returned config. If no configs satisfy the template, an empty list is returned. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: list of `pyglet.gl.Config` :return: A list of matching configs. ''' raise NotImplementedError('abstract')
Example #8
Source File: __init__.py From flappy-bird-py with GNU General Public License v2.0 | 5 votes |
def get_matching_configs(self, template): '''Get a list of configs that match a specification. Any attributes specified in `template` will have values equal to or greater in each returned config. If no configs satisfy the template, an empty list is returned. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: list of `pyglet.gl.Config` :return: A list of matching configs. ''' raise NotImplementedError('abstract')
Example #9
Source File: __init__.py From pyglet with BSD 3-Clause "New" or "Revised" License | 5 votes |
def config(self): """A GL config describing the context of this window. Read-only. :type: :py:class:`pyglet.gl.Config` """ return self._config
Example #10
Source File: base.py From pyglet with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_best_config(self, template=None): """Get the best available GL config. Any required attributes can be specified in `template`. If no configuration matches the template, :class:`~pyglet.window.NoSuchConfigException` will be raised. :deprecated: Use :meth:`pyglet.gl.Config.match`. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: :class:`~pyglet.gl.Config` :return: A configuration supported by the platform that best fulfils the needs described by the template. """ configs = None if template is None: for template_config in [gl.Config(double_buffer=True, depth_size=24, major_version=3, minor_version=3), gl.Config(double_buffer=True, depth_size=16, major_version=3, minor_version=3), None]: try: configs = self.get_matching_configs(template_config) break except window.NoSuchConfigException: pass else: configs = self.get_matching_configs(template) if not configs: raise window.NoSuchConfigException() return configs[0]