Sign in to follow this  
exolon

glUniform1f() in Linux does not work - solved

Recommended Posts

exolon    100
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 :)

Share this post


Link to post
Share on other sites
Katie    2244
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....

Share this post


Link to post
Share on other sites
Yann L    1802
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this