# uniform matrix not being assigned to shader

im trying to apply a rotation matrix to my shader and when i try to set it and mult it in the shader my triangle doesn't render

my drawing code:

        var rotmat = Matrix4d.CreateRotationZ(45);

mesh.Draw();


    public void SetMatrix(string name,Matrix4d mat)
{
int index = GL.GetUniformLocation(Program, name);
GL.UniformMatrix4(index, false,ref mat);
}


#version 440 core
layout (location = 0) in vec3 position;
layout(location = 1) in vec4 color;
layout(location = 20)uniform mat4 transform;

out vec4 fragcolor;

void main(void)
{
gl_Position = transform * vec4(position,1.0);
fragcolor = color;
}


If you wish to change a uniform value you must bind the program first (via glUseProgram); in your code that means calling shader.Use before shader.SetMatrix.
Depending on your GL version you may alternately be able to call glProgramUniformMatrix4fv which doesn't require the program to be bound first.
• @vincentcastro I think you want dmat4 instead of mat4. Similarly, there are dvec3 and dvec4. See Data Type (GLSL). Sep 10 '19 at 4:07