glUniform1f() in Linux does not work - solved

Started by
1 comment, last by Yann L 12 years, 9 months ago
This is just to inform people about an easy solution to a bug which, judging by some googling, has been around since 2007 :/

When using glUniform1f() to set a float value on a uniform in a GLSL shader in Linux (Ubuntu 10.10), you get random values set. This has nothing to do with the driver per se, I got exactly the same behaviour under Mesa OGL on Intel as on the nvidia proprietary driver. It also works if you use GLEW to remap the calls.. so it is probably some header-file somewhere which is incorrectly defining or wrapping the glUniform* family of calls.

In either case, simply using glUniformfv() instead with a count of 1 and a pointer to the float variable you want to set, solves the problem.

Hope this helps someone else (I spent some hours searching for this bug :)
Advertisement
How sure are you about this?

I ask only because... I'm using exactly that function call on Ubuntu 10.10 and 10.04 on NV drivers and it's working fine....
I heard about this issue some time ago, but it seemed to be a random quirk happening only on very few systems. glUniform1f is a very commonly used function, a major malfunction would have been noticed and fixed by now. I was never able to reproduce it.

It's probably a bug somewhere in Mesa (which, considering the abysmal quality of Mesa in general, isn't in the least surprising) that only manifests itself under certain specific build configurations.

This topic is closed to new replies.

Advertisement