Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.gl module

OpenGL wrapping layer

NoCreate constructors

Compared to C++, the Python APIs don’t have an alternative to the NoCreate constructor tag. In C++ these make it possible to have class members initialized before a GL context is present, but in Python there’s no such limitation so these don’t make sense.

Classes

class AbstractFramebuffer
Base for default and named framebuffers
class AbstractShaderProgram
Base for shader program implementations
class AbstractTexture
Base for textures
class Attribute
Vertex attribute location and type
class Buffer
Buffer
class Context
Magnum OpenGL context
class DefaultFramebuffer
Default framebuffer
class Framebuffer
Framebuffer
class Mesh
Mesh
class Renderbuffer
Renderbuffer
class Renderer
Global renderer configuration
class Shader
Shader
class Texture1D
One-dimensional texture
class Texture2D
Two-dimensional texture
class Texture3D
Three-dimensional texture

Enums

class BufferUsage: STREAM_DRAW = 35040 STREAM_READ = 35041 STREAM_COPY = 35042 STATIC_DRAW = 35044 STATIC_READ = 35045 STATIC_COPY = 35046 DYNAMIC_DRAW = 35048 DYNAMIC_READ = 35049 DYNAMIC_COPY = 35050
Buffer usage
class FramebufferBlit: COLOR = 16384 DEPTH = 256 STENCIL = 1024
Mask for framebuffer blitting
class FramebufferBlitFilter: NEAREST = 9728 LINEAR = 9729
Framebuffer blit filtering
class FramebufferClear: COLOR = 16384 DEPTH = 256 STENCIL = 1024
Mask for framebuffer clearing
class MeshIndexType: UNSIGNED_BYTE = 5121 UNSIGNED_SHORT = 5123 UNSIGNED_INT = 5125
Mesh index type
class MeshPrimitive: POINTS = 0 LINES = 1 LINE_LOOP = 2 LINE_STRIP = 3 LINES_ADJACENCY = 10 LINE_STRIP_ADJACENCY = 11 TRIANGLES = 4 TRIANGLE_STRIP = 5 TRIANGLE_FAN = 6 TRIANGLES_ADJACENCY = 12 TRIANGLE_STRIP_ADJACENCY = 13 PATCHES = 14
Mesh primitive type
class RenderbufferFormat: RED = 6403 R8 = 33321 RG = 33319 RG8 = 33323 RGBA = 6408 RGBA8 = 32856 R16 = 33322 RG16 = 33324 RGB16 = 32852 RGBA16 = 32859 R8UI = 33330 RG8UI = 33336 RGBA8UI = 36220 R8I = 33329 RG8I = 33335 RGBA8I = 36238 R16UI = 33332 RG16UI = 33338 RGBA16UI = 36214 R16I = 33331 RG16I = 33337 RGBA16I = 36232 R32UI = 33334 RG32UI = 33340 RGBA32UI = 36208 R32I = 33333 RG32I = 33339 RGBA32I = 36226 R16F = 33325 RG16F = 33327 RGBA16F = 34842 R32F = 33326 RG32F = 33328 RGBA32F = 34836 RGB10A2 = 32857 RGB10A2UI = 36975 RGB5A1 = 32855 RGBA4 = 32854 R11FG11FB10F = 35898 RGB565 = 36194 SRGB8_ALPHA8 = 35907 DEPTH_COMPONENT = 6402 DEPTH_COMPONENT16 = 33189 DEPTH_COMPONENT24 = 33190 DEPTH_COMPONENT32 = 33191 DEPTH_COMPONENT32F = 36012 STENCIL_INDEX = 6401 STENCIL_INDEX1 = 36166 STENCIL_INDEX4 = 36167 STENCIL_INDEX8 = 36168 STENCIL_INDEX16 = 36169 DEPTH_STENCIL = 34041 DEPTH24_STENCIL8 = 35056 DEPTH32F_STENCIL8 = 36013
Internal renderbuffer format
class SamplerCompareFunction: NEVER = 512 ALWAYS = 519 LESS = 513 LESS_OR_EQUAL = 515 EQUAL = 514 NOT_EQUAL = 517 GREATER_OR_EQUAL = 518 GREATER = 516
Texture sampler depth comparison function
class SamplerCompareMode: NONE = 0 COMPARE_REF_TO_TEXTURE = 34894
Depth texture comparison mode
class SamplerDepthStencilMode: DEPTH_COMPONENT = 6402 STENCIL_INDEX = 6401
Texture sampler depth/stencil mode
class SamplerFilter: NEAREST = 9728 LINEAR = 9729
Texture sampler filtering
class SamplerMipmap: BASE = 0 NEAREST = 256 LINEAR = 258
Texture sampler mip level selection
class SamplerWrapping: REPEAT = 10497 MIRRORED_REPEAT = 33648 CLAMP_TO_EDGE = 33071 CLAMP_TO_BORDER = 33069 MIRROR_CLAMP_TO_EDGE = 34627
Texture sampler wrapping
class TextureFormat: RED = 6403 R8 = 33321 RG = 33319 RGB = 6407 RGB8 = 32849 RGBA = 6408 RGBA8 = 32856 SR8 = 36797 SRG8 = 36798 SRGB = 35904 SRGB8 = 35905 SRGB_ALPHA = 35906 SRGB8_ALPHA8 = 35907 R8_SNORM = 36756 RG8_SNORM = 36757 RGB8_SNORM = 36758 RGBA8_SNORM = 36759 R16 = 33322 RG16 = 33324 RGB16 = 32852 RGBA16 = 32859 R16_SNORM = 36760 RG16_SNORM = 36761 RGB16_SNORM = 36762 RGBA16_SNORM = 36763 R8UI = 33330 RG8UI = 33336 RGB8UI = 36221 RGBA8UI = 36220 R8I = 33329 RG8I = 33335 RGB8I = 36239 RGBA8I = 36238 R16UI = 33332 RG16UI = 33338 RGB16UI = 36215 RGBA16UI = 36214 R16I = 33331 RG16I = 33337 RGB16I = 36233 RGBA16I = 36232 R32UI = 33334 RG32UI = 33340 RGB32UI = 36209 RGBA32UI = 36208 R32I = 33333 RG32I = 33339 RGB32I = 36227 RGBA32I = 36226 R16F = 33325 RG16F = 33327 RGB16F = 34843 RGBA16F = 34842 R32F = 33326 RG32F = 33328 RGB32F = 34837 RGBA32F = 34836 R3B3G2 = 10768 RGB4 = 32847 RGB5 = 32848 RGB565 = 36194 RGB10 = 32850 RGB12 = 32851 R11FG11FB10F = 35898 RGB9E5 = 35901 RGBA2 = 32853 RGBA4 = 32854 RGB5A1 = 32855 RGB10A2 = 32857 RGB10A2UI = 36975 RGBA12 = 32858 DEPTH_COMPONENT = 6402 DEPTH_COMPONENT16 = 33189 DEPTH_COMPONENT24 = 33190 DEPTH_COMPONENT32 = 33191 DEPTH_COMPONENT32F = 36012 STENCIL_INDEX8 = 36168 DEPTH24_STENCIL8 = 35056 DEPTH32F_STENCIL8 = 36013
Internal texture format
class Version: NONE = 65535 GL210 = 210 GL300 = 300 GL310 = 310 GL320 = 320 GL330 = 330 GL400 = 400 GL410 = 410 GL420 = 420 GL430 = 430 GL440 = 440 GL450 = 450 GL460 = 460 GLES200 = 65736 GLES300 = 65836 GLES310 = 65846 GLES320 = 65856
OpenGL version

Functions

def is_version_es(arg0: Version, /) -> bool
Whether given version is OpenGL ES or WebGL
def version(major: int, minor: int) -> Version
Enum value from major and minor version number
def version(version: Version) -> tuple[int, int]
Major and minor version number from enum value

Data

default_framebuffer: DefaultFramebuffer
Default framebuffer instance