pyglet.config.gl

class GLSurfaceConfig(
window: WindowT,
config: OpenGLUserConfig,
handle: Any,
) → None

A config representing the capabilities of a specific surface.

This is returned by the platform on a specific window and is not meant to be created by users.

Parameters:
  • window (TypeVar(WindowT, bound= BaseWindow)) – The current window or display.

  • config (OpenGLUserConfig) – The requested user configuration.

  • handle (Any) – A handle to the underlying configuration unique to each platform.

create_context(
opengl_backend: OpenGLBackend,
share: Any,
) → OpenGLSurfaceContext
Return type:

OpenGLSurfaceContext

config: OpenGLUserConfig
class OpenGLUserConfig(
double_buffer: bool | None = None,
stereo: bool | None = None,
buffer_size: int | None = None,
aux_buffers: int | None = None,
sample_buffers: int | None = None,
samples: int | None = None,
red_size: int | None = None,
green_size: int | None = None,
blue_size: int | None = None,
alpha_size: int | None = None,
depth_size: int | None = None,
stencil_size: int | None = None,
accum_red_size: int | None = None,
accum_green_size: int | None = None,
accum_blue_size: int | None = None,
accum_alpha_size: int | None = None,
major_version: int | None = None,
minor_version: int | None = None,
forward_compatible: bool | None = None,
debug: bool | None = None,
transparent_framebuffer: bool | None = None,
api: GraphicsAPI = GraphicsAPI.OPENGL,
) → None

An OpenGL Graphics configuration.

accum_alpha_size: int | None = None

Bits per pixel devoted to the alpha component in the accumulation buffer. Deprecated.

accum_blue_size: int | None = None

Bits per pixel devoted to the blue component in the accumulation buffer. Deprecated.

accum_green_size: int | None = None

Bits per pixel devoted to the green component in the accumulation buffer. Deprecated.

accum_red_size: int | None = None

Bits per pixel devoted to the red component in the accumulation buffer. Deprecated.

alpha_size: int | None = None

Bits per sample per buffer devoted to the alpha component.

api: GraphicsAPI = 'opengl'

Which rendering API is being used (GL, ES, etc.).

aux_buffers: int | None = None

The number of auxiliary color buffers.

blue_size: int | None = None

Bits per sample per buffer devoted to the blue component.

buffer_size: int | None = None

Total bits per sample per color buffer.

debug: bool | None = None

Debug mode.

depth_size: int | None = None

Bits per sample in the depth buffer.

double_buffer: bool | None = None

Specify the presence of a back-buffer for every color buffer.

forward_compatible: bool | None = None

Whether to use forward compatibility mode.

green_size: int | None = None

Bits per sample per buffer devoted to the green component.

property is_finalized: bool
major_version: int | None = None

The OpenGL major version.

minor_version: int | None = None

The OpenGL minor version.

red_size: int | None = None

Bits per sample per buffer devoted to the red component.

sample_buffers: int | None = None

The number of multisample buffers.

samples: int | None = None

The number of samples per pixel, or 0 if there are no multisample buffers.

stencil_size: int | None = None

Bits per sample in the stencil buffer.

stereo: bool | None = None

Specify the presence of separate left and right buffer sets.

transparent_framebuffer: bool | None = None

If the framebuffer should be transparent.

class WebGLUserConfig(
alpha: bool = False,
depth: bool | None = None,
stencil: bool | None = None,
antialias: bool | None = None,
premultipliedAlpha: bool | None = None,
preserveDrawingBuffer: bool | None = None,
failIfMajorPerformanceCaveat: bool | None = None,
powerPreference: str | None = None,
desynchronized: bool | None = None,
) → None

A WebGL Graphics configuration.

alpha: bool = False

Whether the drawing buffer has an alpha channel (pyglet defaults to False).

antialias: bool | None = None

Whether antialiasing is enabled (default True).

property api
depth: bool | None = None

Whether the drawing buffer has a depth buffer (default True).

desynchronized: bool | None = None

Hints to reduce latency by desynchronizing canvas painting (default False).

failIfMajorPerformanceCaveat: bool | None = None

Whether context creation fails if performance is low (default False).

property is_finalized: bool
powerPreference: str | None = None

“default”, “low-power”, or “high-performance” (default “default”).

Type:

Hints GPU preference

premultipliedAlpha: bool | None = None

Whether color values are pre-multiplied by alpha (default True).

preserveDrawingBuffer: bool | None = None

Whether the drawing buffer is preserved after rendering (default False).

stencil: bool | None = None

Whether the drawing buffer has a stencil buffer (default False).

get_surface_config(
user_config: OpenGLUserConfig,
surface: BaseWindow,
) → SurfaceConfig | None
Return type:

SurfaceConfig | None