本文整理汇总了Python中pyglet.gl.Config方法的典型用法代码示例。如果您正苦于以下问题:Python gl.Config方法的具体用法?Python gl.Config怎么用?Python gl.Config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyglet.gl
的用法示例。
在下文中一共展示了gl.Config方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_best_config
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import Config [as 别名]
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]
示例2: get_matching_configs
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import Config [as 别名]
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')
示例3: _init_and_start_app
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import Config [as 别名]
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()
示例4: get_matching_configs
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import Config [as 别名]
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')
示例5: config
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import Config [as 别名]
def config(self):
"""A GL config describing the context of this window. Read-only.
:type: :py:class:`pyglet.gl.Config`
"""
return self._config
示例6: get_best_config
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import Config [as 别名]
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]