Question

I have a shader that has the following uniform declared:

uniform highp float fr;

In my rendering method, it gets set accordingly:

GLfloat num = 1.0f;
glUniform1f(glGetUniformLocation(self.Program, "fr"), num);

But it doesn't get set at all. These seems pretty basic so I can't spot why it isn't working. Have I used the correct syntax?

Was it helpful?

Solution 2

I have found my issue.

I was setting the uniform before calling use program. For anyone that finds this answer, ensure you call use program before setting the uniform for that program.

OTHER TIPS

Maybe you are not using this fr value in shader code? Then compiler would make it inactive uniform and not really include it in compiled program, glGetUniformLocation would return index like -1 or so. Check your shader and what value is returned by glGetUniformLocation.

Cheers, Krzysztof Zabłocki

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top