Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Arrays in shader (.fx) not working for OpenGL

$
0
0

@YTN wrote:

I have an OpenGL project and am currently working on the lighting system.

I am trying to add support for multiple lights by supporting passing an of array of light parameters to my shader.

However, when passing any array, my shader seems to get messed up and everything renders as red. It doesn't matter which attribute I try setting as an array (light color, light position etc). The end result is always a red scene.

Here's an example of how I am declaring the array in the shader:

        float  LightRange[10];

And this is how I am setting it in my c# code:

        float[] LightRange = new float[10];
        LightRange[0] = 50.0f;
        _effect.Parameters["LightRange"].SetValue(LightRange);

Referencing the indexed value in the shader is pretty standard:

         x = LightRange[index] * y;

Any ideas as to what the issue might be?

FYI, I am using build 3.7.0.1441.

Thanks.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles