Config Class

Inheritance diagram of Config

class Config(**kwargs)

Graphics configuration.

A Config stores the preferences for OpenGL attributes such as the number of auxilliary buffers, size of the colour and depth buffers, double buffering, stencilling, multi- and super-sampling, and so on.

Different platforms support a different set of attributes, so these are set with a string key and a value which is integer or boolean.

Variables:
  • double_buffer – Specify the presence of a back-buffer for every color buffer.
  • stereo – Specify the presence of separate left and right buffer sets.
  • buffer_size – Total bits per sample per color buffer.
  • aux_buffers – The number of auxilliary color buffers.
  • sample_buffers – The number of multisample buffers.
  • samples – The number of samples per pixel, or 0 if there are no multisample buffers.
  • red_size – Bits per sample per buffer devoted to the red component.
  • green_size – Bits per sample per buffer devoted to the green component.
  • blue_size – Bits per sample per buffer devoted to the blue component.
  • alpha_size – Bits per sample per buffer devoted to the alpha component.
  • depth_size – Bits per sample in the depth buffer.
  • stencil_size – Bits per sample in the stencil buffer.
  • accum_red_size – Bits per pixel devoted to the red component in the accumulation buffer.
  • accum_green_size – Bits per pixel devoted to the green component in the accumulation buffer.
  • accum_blue_size – Bits per pixel devoted to the blue component in the accumulation buffer.
  • accum_alpha_size – Bits per pixel devoted to the alpha component in the accumulation buffer.

Constructor:

__init__(**kwargs)

Create a template config with the given attributes.

Specify attributes as keyword arguments, for example:

template = Config(double_buffer=True)

Methods:

create_context(share) Create a GL context that satisifies this configuration.
get_gl_attributes() Return a list of attributes set on this config.
is_complete() Determine if this config is complete and able to create a context.
match(canvas) Return a list of matching complete configs for the given canvas.

Attributes:

Methods

Config.create_context(share)

Create a GL context that satisifies this configuration.

Warning

Deprecated. Use CanvasConfig.create_context.

Parameters:share (Context) – If not None, a context with which to share objects with.
Return type:Context
Returns:The new context.
Config.get_gl_attributes()

Return a list of attributes set on this config.

Return type:list of tuple (name, value)
Returns:All attributes, with unset attributes having a value of None.
Config.is_complete()

Determine if this config is complete and able to create a context.

Configs created directly are not complete, they can only serve as templates for retrieving a supported config from the system. For example, pyglet.window.Screen.get_matching_configs returns complete configs.

Warning

Deprecated. Use isinstance(config, CanvasConfig).

Return type:bool
Returns:True if the config is complete and can create a context.
Config.match(canvas)

Return a list of matching complete configs for the given canvas.

Note

Since pyglet 1.2

Parameters:canvas (Canvas) – Display to host contexts created from the config.
Return type:list of CanvasConfig

Attributes

Config.debug = None
Config.forward_compatible = None
Config.major_version = None
Config.minor_version = None

Table Of Contents

Previous topic

CanvasConfig Class

Next topic

Context Class