summaryrefslogtreecommitdiffhomepage
path: root/examples/shaders/shaders_simple_mask.c
diff options
context:
space:
mode:
authorRay <[email protected]>2020-03-02 13:27:54 +0100
committerRay <[email protected]>2020-03-02 13:27:54 +0100
commit485787059a00e54287f465464ce6e430fe9488c6 (patch)
treeb21425bbdd37196c3237cd7fe832d1994b634b7e /examples/shaders/shaders_simple_mask.c
parent08615d3247c46aebd21ad8a9efc2c158c1b4b922 (diff)
downloadraylib-485787059a00e54287f465464ce6e430fe9488c6.tar.gz
raylib-485787059a00e54287f465464ce6e430fe9488c6.zip
Review shader exaples to work on web (GLSL 100)
Diffstat (limited to 'examples/shaders/shaders_simple_mask.c')
-rw-r--r--examples/shaders/shaders_simple_mask.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/shaders/shaders_simple_mask.c b/examples/shaders/shaders_simple_mask.c
index c8762be3..88163b34 100644
--- a/examples/shaders/shaders_simple_mask.c
+++ b/examples/shaders/shaders_simple_mask.c
@@ -21,6 +21,12 @@
#include "raylib.h"
#include "raymath.h"
+#if defined(PLATFORM_DESKTOP)
+ #define GLSL_VERSION 330
+#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
+ #define GLSL_VERSION 100
+#endif
+
int main(void)
{
// Initialization
@@ -50,8 +56,8 @@ int main(void)
Model model3 = LoadModelFromMesh(sphere);
// Load the shader
- Shader shader = LoadShader("resources/shaders/glsl330/mask.vs", "resources/shaders/glsl330/mask.fs");
-
+ Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/mask.fs", GLSL_VERSION));
+
// Load and apply the diffuse texture (colour map)
Texture texDiffuse = LoadTexture("resources/plasma.png");
model1.materials[0].maps[MAP_DIFFUSE].texture = texDiffuse;
@@ -66,7 +72,7 @@ int main(void)
shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask");
// Frame is incremented each frame to animate the shader
- int shaderFrame = GetShaderLocation(shader, "framesCounter");
+ int shaderFrame = GetShaderLocation(shader, "frame");
// Apply the shader to the two models
model1.materials[0].shader = shader;