Subpackages Included
The following subpackages are already included in this "mega" package (and can be found by importing pyglet.gl):
- pyglet.gl.gl: OpenGL
- pyglet.gl.glu: GLU
- pyglet.gl.gl.glext_arb: ARB registered OpenGL extension functions
Subpackages Not Included
These subpackages are also available, but they are not automatically imported into this namespace:
- 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
Information Modules
The following information modules are provided for your convenience.
- exception ConfigException
- exception ContextException
- current_context= None:
The active OpenGL context.
Call Context.set current to change the current context; do not change this global.
- class GLException
- class ObjectSpace
- class Config(**kwargs):
Graphics configuration.
The number of auxilliary buffers, size of the colour and depth buffers, double buffering, stencilling, multi- and super-sampling, and other OpenGL attributes are stored in a Config.
Because different platforms support different sets of attributes, these are defined using a string key and an integer or boolean value.
Variables:
double_buffer (bool) – Indicates whether each colour buffer has a back-buffer.
stereo (bool) – Indicates whether separate left and right buffer sets are present.
buffer_size (int) – Per colour buffer, total bits per sample.
aux_buffers (int) – Auxilliary colour buffers number.
sample_buffers (int) -The number of multisample buffers is specified by sample buffers (int).
samples (int) – Number of samples per pixel, or 0 if no multisample buffers are available.
red_size (int) – The number of bits per sample in each buffer dedicated to the red component.
green_size (int) – The number of bits dedicated to the green component per sample per buffer.
blue_size (int) – The number of bits per sample in each buffer dedicated to the blue component.
alpha_size (int) – The number of bits dedicated to the alpha component per sample per buffer.
depth_size (int) – The depth buffer's bit size per sample.
stencil_size (int) –In the stencil buffer, stencil size (int) is the number of bits per sample.
accum_red_size (int) – Bits per pixel in the accumulation buffer devoted to the red component.
accum_green_size (int) – Bits per pixel in the accumulation buffer devoted to the green component.
accum_blue_size (int) – Bits per pixel in the accumulation buffer devoted to the blue component.
accum_alpha_size (int) – Bits per pixel in the accumulation buffer devoted to the alpha component.
- class CanvasConfig(canvas, base_config):
Configure OpenGL for a specific canvas.
To get an instance of this class, use Config.match.
- class Context(config, context_share=None):
Create a context with CanvasConfig.create context.
Variables: object space (ObjectSpace) – A shared object for all contexts that share GL objects.
FAQs
Is Pyglet slow?
Images (and sprites) in Pyglet can be rotated around any anchor. If you look at pyglet/sprite.py, you'll notice that it uses the Python math module, which explains why it's so slow.
Can Godot use Python?
Godot does not officially support Python. There is a side project that tries to make it work, but using it as a beginner would be a bad idea.
Is KIVY game engine?
Kivy is a free and open source Python framework for creating natural user interface mobile apps and games.
Can pygame make 3D games?
No, Pygame is merely a wrapper for SDL, a 2D API. Pygame does not support 3D and is unlikely to do so in the future. Panda3D and DirectPython are two 3D libraries for Python, though both are likely to be difficult to use, especially the latter.
Is pygame a GUI?
Pygame GUI is a module that allows you to create graphical user interfaces for pygame games. The module is focused on the future, and it is compatible with Pygame 2 and Python 3.
Conclusion
In this article, we saw the theoretical and practical implementation of pyglet.gl in game development.
We hope that this blog has helped you enhance your knowledge regarding pyglet.gl in game development. If you would like to learn more about Pyglet Library, Why is Pyglet used, Asteroids game using Pyglet, and more, check out our articles on Coding Ninjas Studio. Do upvote our blog to help other ninjas grow. Happy Coding!
