Repository: ManimCommunity/manim
File: manim/renderer/shader.py (Python)

Code before:
        )
        if self.indices is None:
            index_buffer_object = None
        else:
            vert_index_data = self.indices.astype("i4").tobytes()
            if vert_index_data:
                index_buffer_object = self.shader.context.buffer(vert_index_data)
            else:
                index_buffer_object = None
        vertex_array_object = self.shader.context.simple_vertex_array(
            self.shader.shader_program,
            vertex_buffer_object,
            *shader_attributes_converted.dtype.names,
            index_buffer=index_buffer_object,
        )
        vertex_array_object.render(self.primitive)
        vertex_buffer_object.release()
        vertex_array_object.release()
        if index_buffer_object is not None:
            index_buffer_object.release()


class Shader:
    def __init__(
        self,
        context: Context,
        name: Path | None = None,
        source: dict | None = None,
    ):
        global shader_program_cache
        self.context = context
        self.name = name

        # See if the program is cached.
        if (
            self.name in shader_program_cache
            and shader_program_cache[self.name].ctx == self.context
        ):
            self.shader_program = shader_program_cache[self.name]
        elif source is not None:
            # Generate the shader from inline code if it was passed.
            self.shader_program = context.program(**source)
        else:
            # Search for a file containing the shader.
            source_dict = {}
            source_dict_key = {
                "vert": "vertex_shader",
                "frag": "fragment_shader",
                "geom": "geometry_shader",
            }
            assert name is not None

Review comment (suggestion):
`context` is not a `cloup.Context`, but rather a `moderngl.Context`.
```suggestion
        context: moderngl.Context,
```

Code after:

        shader_attribute_names: list[str] = []
        for member_name, member in self.shader.shader_program._members.items():
            if isinstance(member, moderngl.Attribute):
                shader_attribute_names.append(member_name)
        filtered_shader_attributes = filter_attributes(
            self.attributes, shader_attribute_names
        )

        vertex_buffer_object = self.shader.context.buffer(
            filtered_shader_attributes.tobytes()
        )
        if self.indices is None:
            index_buffer_object = None
        else:
            vert_index_data = self.indices.astype("i4").tobytes()
            if vert_index_data:
                index_buffer_object = self.shader.context.buffer(vert_index_data)
            else:
                index_buffer_object = None
        vertex_array_object = self.shader.context.simple_vertex_array(
            self.shader.shader_program,
            vertex_buffer_object,
            *filtered_shader_attributes.dtype.names,
            index_buffer=index_buffer_object,
        )
        vertex_array_object.render(self.primitive)
        vertex_buffer_object.release()
        vertex_array_object.release()
        if index_buffer_object is not None:
            index_buffer_object.release()


class Shader:
    def __init__(
        self,
        context: moderngl.Context,
        name: str | None = None,
        source: dict[str, Any] | None = None,
    ):
        global shader_program_cache
        self.context = context
        self.name = name
        self.source = source

        # See if the program is cached.
        if (
            self.name in shader_program_cache
            and shader_program_cache[self.name].ctx == self.context
        ):
            self.shader_program = shader_program_cache[self.name]