ModernGL Types#
Before throwing you into doing shaders we’ll go through some of the most important types/objects in ModernGL.
Bufferis an OpenGL buffer we can for example write vertex data into. This data will reside in graphics memory.Programis a shader program. We can feed it GLSL source code as strings to set up our shader programVertexArrayis a light object responsible for communication betweenBufferandProgramso it can understand how to access the provided buffers and do the rendering call. These objects are currently immutable but are cheap to make.Texture,TextureArray,Texture3DandTextureCuberepresents the different texture types.Textureis a 2d texture and is most commonly used.Framebufferis an offscreen render target. It supports different attachments types such as aTextureand a depth texture/buffer.
All of the objects above can only be created from a Context object:
The ModernGL types cannot be extended as in; you cannot subclass them.
Extending them must be done through substitution and not inheritance.
This is related to performance. Most objects have an extra
property that can contain any python object.