Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a a vertex shader that's split into two files. It has about 30 uniforms (including an array of struct objects). It works just fine in my program on Windows but when I run the application under OS X (10.8) one of the outputs is wrong. I've tracked this down to one of the uniform's values being completely wrong (it's a vec3 with values between +1.0 and +5.0 but on OS X the values are over 10^6). It seems like the uniform is for some reason completely corrupt. I've checked the values being passed to glUniform3f and they're correct. The GLSL version is 1.50 which seems to be supported by OS X 10.8.

Why would the uniform be fine on Windows but have nonsense values on OS X? (Other aspects of the shader seem to be working correctly)

share|improve this question
2  
Did you check glError? Did you print out the shader logs? Have you used gDEBugger or another GL dev tool? Have you tested on other versions of Windows or on other brands of GPU hardware on Windows? What have you done to diagnose this problem? There could be a ton of different problems, many stemming from a possibility that you're just doing something wrong with your code that happens to work on one driver by pure luck/chance (not at all uncommon with OpenGL). – Sean Middleditch Dec 26 '12 at 8:25
1  
First of all you need to get away from the idea that OS is a primary factor here, because it's not. What is important is drivers and the GPUs being used on each of your test platforms. You mention that one of your uniforms is an array of struct objects, but have you checked for how much uniform space you have and whether or not you're exceeding it? – mh01 Dec 26 '12 at 9:09
glGetError doesn't report errors for shaders though there's no errors after glUniform3f(), the shaders compile and link fine, gDEBugger does not support OS X 10.8 AND doesn't support OpenGL 3.3 (even breaks on Windows due to that last problem). I've only tested on one version of Windows. The Windows machine does have a very different GPU than the Mac machine though - Windows is using an ATI GPU and OS X is using nVidia. I'd usually expect something to work on the nVidia drivers before it works on the ATI drivers since it's always the ATI drivers that break. – zenkai Dec 26 '12 at 16:49
The maximum uniforms is 4096 so the shader's definitely not exceeding that. – zenkai Dec 26 '12 at 16:50
1  
Bear in mind that GL_MAX_VERTEX_UNIFORM_LOCATIONS and GL_MAX_FRAGMENT_UNIFORM_COMPONENTS (which you state are 4096 in this situation) is not listing the number of uniforms -- a vec3, for example, uses three locations. An array of two structs each containing a vec3 takes up six locations. These build up quickly! – Trevor Powell Dec 26 '12 at 19:47
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.