summaryrefslogtreecommitdiff
path: root/slideshow/opengl
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>2015-12-09 21:39:24 +0000
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2015-12-11 15:28:59 +0100
commit7d1c123a55d222868e27673685c25d62b1e96cd5 (patch)
tree5e0b019733fe641ab501efbccfb7a34199e43421 /slideshow/opengl
parent566eca14481ea70c83aef30824da911ccf834b41 (diff)
slideshow: Upload the projection and modelview matrices as uniforms
Change-Id: I9d6c3ad0d2cc2f691afb2c8622471286f8a5e1c7
Diffstat (limited to 'slideshow/opengl')
-rw-r--r--slideshow/opengl/basicVertexShader.glsl6
-rw-r--r--slideshow/opengl/reflectionVertexShader.glsl6
2 files changed, 8 insertions, 4 deletions
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);