Shaders are linked to models by the use of materials. A material becomes a component of a mesh, just like a transform. It specifies how the mesh is to be rendered. This means that you can select which shader to use on a model as well as change it. Different models can have different shaders. Create a new Python script called Material py and add the following code to it:
from Utils import *
class Material:
def__init_(self, vertex_shader,
fragment_shader) :
self $\cdot$ program_id = create_program (
open (vertex_shader).read (),
open (fragment_shader).read ())
def use (self):
glUseProgram(self.program_id)