All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
This version includes the following structural changes in moderngl:
- The typehints and inline documentation was moved to moderngl-stubs.
- The Python layer was concatenated but moderngl itself stays a package.
- Most of the protected class members were removed.
- Most of the property aliases became ordinary class members.
- Slots were removed.
...
...
...
...
- Python 3.11 support
- Added support for configurable garbage collection mode.
Context.gc_mode
controls this.None
: (default) No garbage collection is performed. Objects needs to to be manually released like in previous versions of moderngl."context_gc"
: Dead objects are collected inContext.objects
. These can periodically be released usingContext.gc()
."auto"
: Dead objects are destroyed automatically like we would expect in python.
- Added support for
glPolygonOffset
. The factors and units can be set usingContext.polygon_offset
- Added support for normalized signed and unsigned integer textures.
ni1
,nu1
,ni2
andnu2
are the new dtypes for these. - Added
Context.external_texture
for creating textures from existing OpenGL textures. - Added
TextureCube.bind_to_image
so we can easily access cube textures in compute shaders - Added
Texture3D.bind_to_image
so we can easily access 3D textures in compute shaders - Added
TextureArray.bind_to_image
so we can easily access texture arrays in compute shaders - Added support for specifying a custom internalformat for cube maps. This can be used for sRGB and texture compression formats.
- Integer textures now use
NEAREST
interpolation by default. This was causing issues with some drivers. - Added support for writing to multiple buffers in transforms.
Context.program
now accepts a dictionary for mapping sampler names to specific texture units.- Added
Program.is_transform
exposing if the program has a fragment shader or not - Added
VertexArray.mode
and amode
argument inContext.vertex_array
. This is now the default rendering mode when no mode parameter is passed inrender()
ortransform()
- Added support for 1D sampler in
Uniform
- Added direct access to
glEnable
/glDisable
inContext.enable_direct
/Context.disable_direct
. This can be used to enabled capabilities not supported by ModernGL. Framebuffer.read()
now has aclamp
(bool) parameter. If enabled, floating point data will clamp to[0.0, 1.0]
. Clamping is disabled by default.- Fixed a bug causing
copy_framebuffer
to not work with multisampled framebuffers with multiple color attachments. - Fixed a bug in
copy_framebuffer
that caused the draw buffers to be permanently changed. - VertexArray: Removed "the first vertex attribute must not be a per instance attribute" limitation
- Fixed a crash when reading
ctx.provoking_vertex
- Added workaround for MacOS requiring a framebuffer to be bound in headless mode even for transform shaders. We simply create and bind a framebuffer internally.
- Added
GL_MAX_GEOMETRY_OUTPUT_VERTICES
toContext.info
- Docstring improvements
- Documentation improvements
- Transform feedback now supports all primitive modes both for vertex and geometry shaders
VertexArray.transform()
now raises sane errors when using the wrong primitive mode with geometry shadersVertexArray.transform()
now automatically detects output primitive based on the input mode.GL_TRIANGLES_ADJACENCY
enum incorrectly mapped (D0
instead of0D
)- Primitive modes are now accessible in the
Context
instance. For example:ctx.POINTS
andctx.TRIANGLES
- Texture filers are now also available in the
Context
instance. For example:ctx.NEAREST
andctx.LINEAR
- Docstring and documentation improvements
- Added
Context.extensions
. This is aset
containing the OpenGL extensions supported by the context. - Added support for overridable internal_format for
Texture
. This opens up for sRGB and compressed formats if needed. - Docstring and documentation improvements
TextureArray.build_mimpmaps()
used the wrong target when building mipmaps. This caused the texture to corrupt with some drivers. Thanks to Nir Aides for discovering this bug.- Docstring improvements
- Added
Context.cull_face
. (glCullFace
). An alternative toContext.front_face
(glFrontFace
) - Added support for signed and unsigned integer sampler uniforms (
isampler*
,usampler*
) - Added support for multisampled texture array samplers
- Doc improvements
- Transform feedback with geo shader should now property set the out primitive type.
It incorrectly assumed
POINTS
in some cases causing a gl error. - Moderngl will now propagate the default error messages when objects cannot be read using the buffer protocol.
5.6.0 - 2020-02-01
From ModernGL 5.6 context creation is done by the glcontext package. This means we can keep improving context creation without releasing new moderngl versions. The bar for contributing to context creation is also lower. Backends can be written in C++ or by simply using ctypes.
This version also has a lot of improvements to docsstrings, api docs and documentation in general. Still we have a lot more work to do in this area.
- Standalone
Context
can now be destroyed on all platforms - Compute shaders can now write to textures using
Texture*.bind_to_image
VertexBuffer.transform
now as abuffer_offset
parameter for setting the start byte offset of the output buffer. This can be used in many creative ways in for example particle emitting.Framebuffer
supports having only depth buffer. This makes things like shadow mapping easier to work with.- Support for
PROGRAM_POINT_SIZE
context flag so point sizes can be set in the vertex shader - Scissor test support.
Framebuffer.scissor
andContext.scissor
can now be used to set and enable scissor testing per framebuffer. - The
Framebuffer.clear
have an optionalcolor
parameter to replace the oldred, green, blue, alpha
parameters. - Samplers and Buffers have an
assign
method to simplify the scope creation. - Samplers have an optional
texture
parameter that will be used together with the sampler when given. - The Scope's
enable_only
keyword argument is deprecated in favor of theenable
keyword argument. - Buffers have a
bind
method that replaces the tuples in the VertexArray creation. - VertexArrays have an optional
scope
property that will be used when rendering. - The VertexArray's
vertices
property is now writeable. - VertexArrays have an
instances
property to control the default number of instances when rendering. - The Context object contains the constants provided by the moderngl module. The constants are: (TRIANGLE, LINES, DEPTH_TEST, ...)
- The
framebuffer
parameter is optional in Scopes. - The
ctx.simple_vertex_array
is deprecated in favor of usingctx.vertex_array
with the same parameters. - The
prog[uniform].value = value
is deprecated in favor of usingprog[uniform] = value
. - The
prog[uniform].write(bytes_value)
is deprecated in favor of using theprog[uniform] = bytes_value
.
- Fixed an issue with attribute format detection causing integer and double types to fail
- Several minor bug fixes
5.5.4 - 2019-11-10
This version was originally meant to only add python 3.8 support, but a few additions and fixes where cherry-picked from the 5.6 branch.
- Python 3.8 support
Vertexarray
s can now be crated without any content.Context.blend_func
now supports separate blend functions for rgb and alpha.- Added
Context.blend_equation
supporting separate blend equations for rgb and alpha.
5.5.3 - 2019-08-16
- Scope object uniform buffer bindings.
5.5.2 - 2019-06-13
- missing package in setup.py
5.5.1 - 2019-06-12
- offset fix for vao render
5.5.0 - 2019-01-22
- depth texture filter and compare func
- scope restores old enable flags properly
- clear gl errors as the final step of initialization
- fix default framebuffer's number of attachments
- documentation for
extra
properties - improved documentation
- improved build on Mac
5.4.2 - 2018-08-01
- included
moderngl.program_members
in the package list
5.4.1 - 2018-07-30
- broken description on PyPI
5.4.0 - 2018-07-30
- Sampler object support
Context.sampler
methodContext.max_anisotropy
propertyContext.clear_samplers
methodFramebuffer.read
andFramebuffer.read_into
now acceptsattachment=-1
to read the depth attachmentTexture.compare_func
propertyTexture.anisotropy
property- docs and tests
- missing
ComputeShader
uniforms and uniform blocks - wrong
DrawBuffer
call when clearing the screen - reading depth values from textures
- broken compare functions
5.3.0 - 2018-06-27
index_element_size
parameter forContext.vertex_array
andContext.simple_vertex_array
- comapre fuctions
5.2.1 - 2018-05-10
- markdown readme issues
5.2.0 - 2018-05-10
Context.core_profile_check
methodGL_CONTEXT_PROFILE_MASK
toContext.info
GL_PATCHES
constant for drawing patches- getter and setter for
GL_PATCH_VERTICES
- markdown readme
- tesselation control and tesselation evaluation shader being swapped when creating a program
5.1.0 - 2018-04-28
- offset and size parameter to
Buffer.bind_to_uniform_block
- offset and size parameter to
Buffer.bind_to_storage_buffer
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT
toContext.info
5.0.7 - 2018-04-08
- minor bugs in Buffer Format
5.0.6 - 2018-03-22
standalone_context
on linux issue #173
5.0.5 - 2018-03-21
- Standalone context on linux fails when the default display is nonzero.
5.0.4 - 2018-03-07
- Standalone context on windows fails when old GPU driver is installed.
5.0.3 - 2018-02-28
- TextureArray objects
- Indirect drawing
- Restored Error class from ModernGL4
- Properly set subroutines in VertexArray render
5.0.2 - 2018-02-20
- Wrong module name in some windows based wheel files
5.0.1 - 2018-02-19
- Build errors and warnings for older python versions
5.0.0 - 2018-02-18
For more information please see: Differences between ModernGL5 and ModernGL4
- Query objects
- Scope objects
- Conditional Rendering
- New
RASTERIZER_DISCARD
enable flag - Context fbo attribute
- Context depth_func and blend_func
- Depth Texture compare_func
- Most of the constants became integers
- Renamed
default_framebuffer
toscreen
and always points to framebuffer 0 - VertexArray's buffer formats
- Program creation
- Program members
- Replace floats parameter with dtype
- Classes and methods that are no longer needed
4.2.2 - 2018-01-06
- Program.__getitem__ returns Uniforms, UniformBuffers, Attributes and Varyings
4.2.1 - 2017-11-25
- UniformMap.get, AttributeMap.get, ... methods
- Context.info
GL_MAX_COMPUTE_WORK_GROUP_COUNT
value - Missing TextureCube class
- Buffer.clear return type hint
4.2.0 - 2017-10-17
- Default framebuffer bits attribute
- Context.detect_framebuffer
- Support reserving buffers with human readable sizes
- Standalone context on linux requires 24 bits for the depth buffer at least
- Bound framebuffer reference count
4.1.12 - 2017-08-22
- TextureCube class and Context
texture_cube
method - Context
enable_only
method
- Enable flags support bitwise
__or__
,__and__
and__inv__
- Framebuffer does not create a Renderbuffer when the depth_attachment is None
ModernGL.MULTISAMPLE
constant- Version class and Version constants
- Texture3D created with wrong type
4.1.11 - 2017-07-02
- Context
front_face
attribute
- VertexArray
program
member type - Context
viewport
attribute missingtuple
cast - Misplaced
GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS
- Compile warnings (strict-prototypes)
- Initial value of
wireframe
4.1.10 - 2017-06-23
- Documentation improvements
- Context
max_samples
attribute
- Validate the number of samples using wrong values
4.1.9 - 2017-06-23
- Context
info
attribute - Support Textures in
copy_framebuffer
- Texture
floats
attribute
- 3D texture
depth
attribute type
4.1.8 - 2017-06-19
- 3D texture support (
Texture3D
class and Contexttexture3d
method) - Context
max_integer_samples
attribute - Fallback display for linux
- Unused texture's
read
method'sviewport
parameter
- Broken framebuffer
color_attachments
attribute - Segmentation fault when creating a texture using string data by mistake
- Validate Renderbuffer and Texture samples
4.1.7 - 2017-06-13
- Uniform
read
andwrite
methods write_offset
parameter for theread_into
methods- Read framebuffer's pixels to a buffer
- Read texture's pixels to a buffer
- Write texture's from a buffer
- Pixel Buffer Object
- Default framebuffer wrong drawbuffers
- Framebuffer non zero viewport settings
- Uniform setter error messages
4.1.6 - 2017-06-12
- Broken uniform setter in 4.1.5
4.1.5 - 2017-06-09
- Modifying framebuffer properties has no effect unless the framebuffer is explicitly bound
4.1.4 - 2017-06-07
- Framebuffer
color_mask
attribute - Framebuffer
depth_mask
attribute - Framebuffer
viewport
attribute
copy_framebuffer
usingdefault_framebuffer
- Failing
__repr__
in VertexArrays
- Framebuffer methods do not affect the bound framebuffer
- Invalid texture sampling parameters for multisample textures
- Invalid texture sampling parameters for depth textures
4.1.3 - 2017-06-04
- TextureFilter and TextureWrap classes and constants
- Texture
build_mipmaps
method - Texture
repeat_x
,repeat_y
andfilter
attributes - Texture
swizzle
getter
4.1.2 - 2017-05-31
- Read any color attachments of the Framebuffer
- Framebuffer, Buffer, BufferAccess and Texture
read_into
method __slots__
for ModernGL classes- Framebuffer read different color attachments
- Tkinter connector for windows using ctypes
- Multiple render targets
- Non-float renderbuffers are not readable
- Buffer
read
keyword onlyoffset
argument
Context.renderbuffer
will usefloats=False
by defaultbind_to_uniform_block
location
parameter was renamed tobinding
bind_to_storage_buffer
location
parameter was renamed tobinding
4.1.1 - 2017-05-27
- UniformBlock
binding
andsize
attribute - Framebuffer
width
,height
andsamples
attribute - Texture
swizzle
attribute - Context
error
attribute - OpenGL objects as
glo
attributes - Buffer
clear()
method - Missing
release()
methods - Iterable program member maps
- Human readable program members
- Pixel pack and unpack alignments
- Subroutines
- UniformBlock
array_size
andlocation
attribute - VertexArrayAttribute
default
attribute
- BufferAccess unused
offset
parameter - Binding buffer to a UniformBlock
- Broken RTD docs
4.1.0 - 2017-05-24
- Exception handling when importing the implementation
- Standalone context on linux and mac with fallback mechanism
- Require version at context creation
- Context
version_code
property - Framebuffer
clear()
method
- Context
clear()
method accepts floats
- Required
-std=c++11
for linux and mac - ModernGL
VERSION
constant
Framebuffer
andTexture
can have uninitialized x, y values- Uniform setters
4.0.0 - 2017-05-20
- Full linting support
- Restructure docs
- Examples in docs
- pep8 style
- VSCode snippets
- Changelog
- Wrap the C/C++ module with a pure python module
- Rename internal module to avoid ambiguosity
- Rename class like members from the Context class
3.1.5 - 2017-05-07
- Standalone ModernGL context
- Sphinx generated docs
- Linting with pylint mock file
- Mac OSX support
3.1.0 - 2017-03-01
- Wrapping OpenGL objects with python types
- Improved Linux support
- Direct access to OpenGL objects
2.4.1 - 2016-08-30
- setup.py and PyPI compatible packaging
- Direct access to OpenGL objects
- Linux support
- It was a tool for me to develop games in python