http://bugs.freedesktop.org/show_bug.cgi?id=26224
Summary: [GLSL] Cannot get location of a uniform struct member Product: Mesa Version: 7.6 Platform: x86-64 (AMD64) OS/Version: Linux (All) Status: NEW Severity: normal Priority: medium Component: Mesa core AssignedTo: mesa3d-dev@lists.sourceforge.net ReportedBy: mo6e...@gmail.com Hello, using the below fragment and vertex shaders, I am unable to obtain the location of Material.color, Material.emission or Material.specular. After successfully compiling the shaders and linking a program, calling glUniformLocation(program, "Material.color"); glUniformLocation(program, "Material.emission"); glUniformLocation(program, "Material.specular"); all return -1; and glGetError() returns GL_NO_ERROR. Strangely, glUniformLocation(program, "Material"); returns a valid uniform location, which can be set using glUniform1f and corresponds to Material.color.r . Even more perplexingly, calling glGetActiveUniform returns the following info: Name: Material Size: 2 Type: 5126 (GL_FLOAT) I can get the location of Material[0] and Material[1] (and even higher indices without raising errors). Setting Material[0] has the same effect as setting Material.color.r and setting Material[1] has the same effect as setting Material.specular. Setting any higher index does not have a discernible effect. My hardware is an Intel GM45 Express IGP. I'm using Mesa 7.6 from Ubuntu 9.10 with a 2.6.32.2 kernel. Vertex shader: uniform mat4 MV; uniform mat4 MVP; uniform mat3 N; varying vec3 EyeN; varying vec4 EyeV; void main() { gl_PointSize = 1; gl_Position = MVP * gl_Vertex; EyeV = MV * gl_Vertex; EyeN = normalize( N * gl_Normal ); } Fragment shader: struct TMaterial { vec3 color; float emission; float specular; }; uniform TMaterial Material; uniform float LightAmbient; varying vec3 EyeN; varying vec4 EyeV; void main() { vec3 v3EyeV = vec3(EyeV / EyeV.w); float emissionAttenuation = dot(v3EyeV, v3EyeV); float effEmission = Material.emission / (1 + emissionAttenuation); vec3 effColor = Material.color * ( effEmission + LightAmbient ); gl_FragColor = vec4(effColor, 1); } -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev