From 3abbf9227ada8f68821a5ad473bba4f52e625fb5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 13 Feb 2015 15:37:22 +0100 Subject: Avoid instance names in uniform blocks Version 140 (OpenGL 3.1) does not support the namespacing features yet. Instance names are introduced only in 150 (OpenGL 3.2). Change-Id: I3917093113beff6049c25c3282c13062d220700b Reviewed-by: Sean Harmer --- examples/deferred-renderer-cpp/final_gl3.frag | 6 +++--- examples/deferred-renderer-qml/FinalEffect.qml | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/deferred-renderer-cpp/final_gl3.frag b/examples/deferred-renderer-cpp/final_gl3.frag index fe4854f2d..8aeb1cbcf 100644 --- a/examples/deferred-renderer-cpp/final_gl3.frag +++ b/examples/deferred-renderer-cpp/final_gl3.frag @@ -18,7 +18,7 @@ struct PointLight const int lightCount = 3; uniform PointLightBlock { PointLight lights[lightCount]; -} pointLights; +}; void main() { @@ -29,8 +29,8 @@ void main() vec4 lightColor; for (int i = 0; i < 3; i++) { - vec3 s = normalize(pointLights.lights[i].position - pos); - lightColor += pointLights.lights[i].color * (pointLights.lights[i].intensity * max(dot(s, norm), 0.0)); + vec3 s = normalize(lights[i].position - pos); + lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0)); } lightColor /= float(lightCount); fragColor = col * lightColor; diff --git a/examples/deferred-renderer-qml/FinalEffect.qml b/examples/deferred-renderer-qml/FinalEffect.qml index f4a4e984d..632487688 100644 --- a/examples/deferred-renderer-qml/FinalEffect.qml +++ b/examples/deferred-renderer-qml/FinalEffect.qml @@ -86,7 +86,7 @@ Effect { const int lightCount = 5; uniform PointLightBlock { PointLight lights[lightCount]; - } pointLights; + }; void main() { @@ -97,8 +97,8 @@ Effect { vec4 lightColor; for (int i = 0; i < lightCount; i++) { - vec3 s = normalize(pointLights.lights[i].position - pos); - lightColor += pointLights.lights[i].color * (pointLights.lights[i].intensity * max(dot(s, norm), 0.0)); + vec3 s = normalize(lights[i].position - pos); + lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0)); } lightColor /= float(lightCount); fragColor = col * lightColor; @@ -153,7 +153,7 @@ Effect { uniform struct { PointLight lights[lightCount]; - } pointLights; + }; void main() { @@ -164,8 +164,8 @@ Effect { vec4 lightColor; for (int i = 0; i < lightCount; i++) { - vec3 s = normalize(pointLights.lights[i].position - pos); - lightColor += pointLights.lights[i].color * (pointLights.lights[i].intensity * max(dot(s, norm), 0.0)); + vec3 s = lights[i].position - pos); + lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0)); } lightColor /= float(lightCount); gl_FragColor = col * lightColor; -- cgit v1.2.3