How can I set that uniform?
\nWith OpenGL I would do something like this:
\nint location = glGetUniformLocation(shader_id, \"u_view_projection\");\nfloat matrix[] = { ... };\nglUniformMatrix4fv(location, 1, GL_FALSE, matrix);
Take a look at the ResourceBinding example and search for \"uniform\". The GLSL shader use two uniforms, instance
and lightVec
. They have to be declared in the PipelineLayout
and then set via CommandBuffer::SetUniform
each time the respective PSO is bound.
-
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.
-
Take a look at the ResourceBinding example and search for "uniform". The GLSL shader use two uniforms, |
Beta Was this translation helpful? Give feedback.
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.