Module pyglet.gl.gl_info

Information about version and extensions of current GL implementation.

Usage:

from pyglet.gl import gl_info

if gl_info.have_extension('GL_NV_register_combiners'):
    # ...

If you are using more than one context, you can set up a separate GLInfo object for each context. Call set_active_context after switching to the context:

from pyglet.gl.gl_info import GLInfo

info = GLInfo()
info.set_active_context()

if info.have_version(2, 1):
    # ...

Classes

  GLInfo
Information interface for a single GL context.

Functions

  set_active_context()
Store information for the currently active context.
  remove_active_context()
bool have_extension(extension)
Determine if an OpenGL extension is available.
list of str get_extensions()
Get a list of available OpenGL extensions.
str get_version()
Get the current OpenGL version.
bool have_version(major, minor=0, release=0)
Determine if a version of OpenGL is supported.
str get_renderer()
Determine the renderer string of the OpenGL context.
str get_vendor()
Determine the vendor string of the OpenGL context.
bool have_context()
Determine if a default OpenGL context has been set yet.

Variables

  __package__ = 'pyglet.gl'

Function Details

set_active_context

set_active_context()

Store information for the currently active context.

This method is called automatically for the default context.

have_extension

have_extension(extension)
Determine if an OpenGL extension is available.
Parameters:
extension : str
The name of the extension to test for, including its GL_ prefix.
Returns:
bool: True if the extension is provided by the driver.

get_extensions

get_extensions()
Get a list of available OpenGL extensions.
Returns:
list of str: a list of the available extensions.

get_version

get_version()
Get the current OpenGL version.
Returns:
str: the OpenGL version

have_version

have_version(major, minor=0, release=0)
Determine if a version of OpenGL is supported.
Parameters:
major : int
The major revision number (typically 1 or 2).
minor : int
The minor revision number.
release : int
The release number.
Returns:
bool: True if the requested or a later version is supported.