From 7d1c123a55d222868e27673685c25d62b1e96cd5 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 9 Dec 2015 21:39:24 +0000 Subject: slideshow: Upload the projection and modelview matrices as uniforms Change-Id: I9d6c3ad0d2cc2f691afb2c8622471286f8a5e1c7 --- slideshow/opengl/basicVertexShader.glsl | 6 ++++-- slideshow/opengl/reflectionVertexShader.glsl | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'slideshow/opengl') diff --git a/slideshow/opengl/basicVertexShader.glsl b/slideshow/opengl/basicVertexShader.glsl index a4b258c69043..ebd5dbcc6585 100644 --- a/slideshow/opengl/basicVertexShader.glsl +++ b/slideshow/opengl/basicVertexShader.glsl @@ -28,6 +28,8 @@ #version 120 +uniform mat4 u_projectionMatrix; +uniform mat4 u_modelViewMatrix; uniform mat4 u_sceneTransformMatrix; uniform mat4 u_primitiveTransformMatrix; uniform mat4 u_operationsTransformMatrix; @@ -37,9 +39,9 @@ varying vec3 v_normal; void main( void ) { - mat4 modelViewMatrix = gl_ModelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix; + mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix; mat3 normalMatrix = mat3(transpose(inverse(modelViewMatrix))); - gl_Position = gl_ProjectionMatrix * modelViewMatrix * gl_Vertex; + gl_Position = u_projectionMatrix * modelViewMatrix * gl_Vertex; v_texturePosition = gl_MultiTexCoord0.xy; v_normal = normalize(normalMatrix * gl_Normal); } diff --git a/slideshow/opengl/reflectionVertexShader.glsl b/slideshow/opengl/reflectionVertexShader.glsl index ad9b0330322d..566eafa7590b 100644 --- a/slideshow/opengl/reflectionVertexShader.glsl +++ b/slideshow/opengl/reflectionVertexShader.glsl @@ -28,6 +28,8 @@ #version 130 +uniform mat4 u_projectionMatrix; +uniform mat4 u_modelViewMatrix; uniform mat4 u_sceneTransformMatrix; uniform mat4 u_primitiveTransformMatrix; uniform mat4 u_operationsTransformMatrix; @@ -38,9 +40,9 @@ varying float v_isShadow; void main( void ) { - mat4 modelViewMatrix = gl_ModelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix; + mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix; mat3 normalMatrix = mat3(transpose(inverse(modelViewMatrix))); - gl_Position = gl_ProjectionMatrix * modelViewMatrix * gl_Vertex; + gl_Position = u_projectionMatrix * modelViewMatrix * gl_Vertex; v_texturePosition = gl_MultiTexCoord0.xy; v_normal = normalize(normalMatrix * gl_Normal); v_isShadow = float(gl_VertexID >= 6); -- cgit v1.2.3