Shader uniforms #118
-
I have a glsl shader that takes a uniform, for example: uniform mat4 u_view_projection; How can I set that uniform? With OpenGL I would do something like this: int location = glGetUniformLocation(shader_id, "u_view_projection");
float matrix[] = { ... };
glUniformMatrix4fv(location, 1, GL_FALSE, matrix); |
Beta Was this translation helpful? Give feedback.
Answered by
LukasBanana
Jun 12, 2024
Replies: 1 comment
-
Take a look at the ResourceBinding example and search for "uniform". The GLSL shader use two uniforms, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
LukasBanana
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take a look at the ResourceBinding example and search for "uniform". The GLSL shader use two uniforms,
instance
andlightVec
. They have to be declared in thePipelineLayout
and then set viaCommandBuffer::SetUniform
each time the respective PSO is bound.