Package pyglet.gl

OpenGL and GLU interface.

This package imports all OpenGL, GLU and registered OpenGL extension functions. Functions have identical signatures to their C counterparts. For example:

from pyglet.gl import *

# [...omitted: set up a GL context and framebuffer]
glBegin(GL_QUADS)
glVertex3f(0, 0, 0)
glVertex3f(0.1, 0.2, 0.3)
glVertex3f(0.1, 0.2, 0.3)
glEnd()

OpenGL is documented in full at the OpenGL Reference Pages.

The OpenGL Programming Guide is a popular reference manual organised by topic. The free online version documents only OpenGL 1.1. Later editions cover more recent versions of the API and can be purchased from a book store.

The following subpackages are imported into this "mega" package already (and so are available by importing pyglet.gl):

pyglet.gl.gl
OpenGL
pyglet.gl.glu
GLU
pyglet.gl.gl.glext_arb
ARB registered OpenGL extension functions
pyglet.gl.gl.glext_missing
ARB registered OpenGL extension functions not included in the ARB C header

These subpackages are also available, but are not imported into this namespace by default:

pyglet.gl.glext_nv
nVidia OpenGL extension functions
pyglet.gl.agl
AGL (Mac OS X OpenGL context functions)
pyglet.gl.glx
GLX (Linux OpenGL context functions)
pyglet.gl.glxext_arb
ARB registered GLX extension functions
pyglet.gl.glxext_nv
nvidia GLX extension functions
pyglet.gl.wgl
WGL (Windows OpenGL context functions)
pyglet.gl.wglext_arb
ARB registered WGL extension functions
pyglet.gl.wglext_nv
nvidia WGL extension functions

The information modules are provided for convenience, and are documented below.

Submodules

pyglet.gl.gl_info
Information about version and extensions of current GL implementation.
pyglet.gl.glu_info
Information about version and extensions of current GLU implementation.

Classes

  Config
Graphics configuration.
  ObjectSpace
  Context
OpenGL context for drawing.
  ContextException
  ConfigException

Functions

Context get_current_context()
Return the active OpenGL context.

Variables

  current_context = None
  glBindTexture = <_FuncPtr object at 0x9fd0a54>
  glTexImage2D = <_FuncPtr object at 0xa0813d4>
  glDeleteTextures = <_FuncPtr object at 0xa047094>
  __package__ = 'pyglet.gl'

Function Details

get_current_context

get_current_context()

Return the active OpenGL context.

You can change the current context by calling Context.set_current.

Returns:
Context: the context to which OpenGL commands are directed, or None if there is no selected context.

Deprecated: Use current_context