Sign in to follow this  

glUniform1f() in Linux does not work - solved

This topic is 2344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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

This topic is 2344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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