Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
use glsl 120
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
  • Loading branch information
iche033 committed Jan 16, 2021
1 parent 5f426b2 commit cf404b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
14 changes: 7 additions & 7 deletions media/materials/programs/spotlight_shadow_demo_fp.glsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#version 130
#version 120

uniform sampler2D shadowMap0;
in vec4 lightSpacePos0;
varying vec4 lightSpacePos0;

in vec4 worldPos;
in vec4 worldViewPos;

out vec4 outputCol;
varying vec4 worldPos;
varying vec4 worldViewPos;

//------------------------------------------------------------------------------
float ShadowSimple(in sampler2D shadowMap, in vec4 shadowMapPos)
Expand Down Expand Up @@ -34,11 +32,13 @@ void main()
float f = 0.0f;

// flat red color - no lighting
outputCol = vec4(1.0, 0.0, 0.0, 1.0);
vec4 outputCol = vec4(1.0, 0.0, 0.0, 1.0);

// grey shadows
f += ShadowSimple(shadowMap0, lightSpacePos0);
f = clamp(f, 0.0f, 1.0f);
if (f > 0.0f)
outputCol = vec4(0.2, 0.2, 0.2, 1.0);

gl_FragColor = outputCol;
}
14 changes: 6 additions & 8 deletions media/materials/programs/spotlight_shadow_demo_vp.glsl
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
#version 130

in vec4 position;
#version 120

uniform mat4 worldMatrix;
uniform mat4 worldViewMatrix;
uniform mat4 viewProjMatrix;

uniform mat4 texViewProjMatrix0;
out vec4 lightSpacePos0;
varying vec4 lightSpacePos0;

out vec4 worldPos;
out vec4 worldViewPos;
varying vec4 worldPos;
varying vec4 worldViewPos;

void main()
{
worldPos = worldMatrix * position;
worldPos = worldMatrix * gl_Vertex;
gl_Position = viewProjMatrix * worldPos;

worldViewPos = worldViewMatrix * position;
worldViewPos = worldViewMatrix * gl_Vertex;

lightSpacePos0 = texViewProjMatrix0 * worldPos;
}
Expand Down

0 comments on commit cf404b1

Please sign in to comment.