-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
The VAO instance method uses the program id as a key to cache VertexArray internally.
However, if the original Program is released, and a new Program is created, the opengl id of the new Program may be the same as the original program.
But the vertex attributes of the new Program have a different layout. At this time, calling the VAO instance method to get the VertexArray from the cache will be wrong!
This is a potential error behavior, difficult to be discovered.
A better way might be to remember the layout of the vertices, see if they are consistent, and then decide whether to reuse the VertexArray in the cache.
Source code with potential issues:
def instance(self, program: moderngl.Program) -> moderngl.VertexArray:
"""Obtain the ``moderngl.VertexArray`` instance for the program.
The instance is only created once and cached internally.
Args:
program (moderngl.Program): The program
Returns:
``moderngl.VertexArray``: instance
"""
vao = self.vaos.get(program.glo)
if vao:
return vaoMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working