-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shader Uniform Arrays #14
Comments
Hi @spyion , shaderProgram["lightPositions[0]"].SetValue(lights[0].Position);
shaderProgram["lightPositions[1]"].SetValue(lights[1].Position);
shaderProgram["lightPositions[2]"].SetValue(lights[2].Position);
// ...
shaderProgram["lightPositions[10]"].SetValue(lights[10].Position); assuming that the variable Hope this will help you! :-) |
I don't know why, but this is not working. |
I've browsed the source code of opengl4csharp and it seems that the list of uniform variables is created once when the shader is compiled in OpenGL and not when the user want to request it (and this method work only for non-array variables, and maybe also for structs...) Hope this will help you! :-) |
Thanks for the comments (and for the slow response). Yes, the uniform variables are currently only found at link time. It should be expanded to work with other types, as mentioned. However, this work hasn't been done yet. |
Is there any way to set a shaders uniform arrays.
e.g.
glsl:
uniform vec3 lightPositions[10];
c#:
i can reference the array using shaderProgram["lightPositions[0]"], but i can only set the first value.
shaderProgram["lightPositions[1]"] or shaderProgram["lightPositions[]"] returns null.
The text was updated successfully, but these errors were encountered: