Is there any way to set mat3 or mat4 uniform into my custom fragment shader?
Graphic3d_ShaderProgram::PushVariable supports only a limited set of types :(
gkv311 n Tue, 12/16/2025 - 08:01
Not without patching OCCT as far as I can see:
OpenGl_VariableSetterSelector::OpenGl_VariableSetterSelector()
{
// Note: Add new variable setters here
mySetterList = OpenGl_HashMapInitializer::CreateListOf<size_t, OpenGl_SetterInterface*>
(Graphic3d_UniformValueTypeID<int>::ID, new OpenGl_VariableSetter<int>())
(Graphic3d_UniformValueTypeID<float>::ID, new OpenGl_VariableSetter<float>())
(Graphic3d_UniformValueTypeID<OpenGl_Vec2>::ID, new OpenGl_VariableSetter<OpenGl_Vec2>())
(Graphic3d_UniformValueTypeID<OpenGl_Vec3>::ID, new OpenGl_VariableSetter<OpenGl_Vec3>())
(Graphic3d_UniformValueTypeID<OpenGl_Vec4>::ID, new OpenGl_VariableSetter<OpenGl_Vec4>())
(Graphic3d_UniformValueTypeID<OpenGl_Vec2i>::ID, new OpenGl_VariableSetter<OpenGl_Vec2i>())
(Graphic3d_UniformValueTypeID<OpenGl_Vec3i>::ID, new OpenGl_VariableSetter<OpenGl_Vec3i>())
(Graphic3d_UniformValueTypeID<OpenGl_Vec4i>::ID, new OpenGl_VariableSetter<OpenGl_Vec4i>());
}
I suggest defining as set of vec3/vec4 uniforms instead and pack them into mat3/mat4 within the shader, if you are not willing to make modifications in OCCT.
in vec3 uMat0;
in vec3 uMat1;
in vec3 uMat2;
...
void main() {
mat3 aMat = mat3(uMat0, uMat1, uMat2);
...
}
Make sure to check row or column-major order expectations.
Tue, 12/16/2025 - 08:01
Not without patching OCCT as far as I can see:
I suggest defining as set of
vec3/vec4uniforms instead and pack them intomat3/mat4within the shader, if you are not willing to make modifications in OCCT.Make sure to check row or column-major order expectations.