本文整理匯總了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]