summaryrefslogtreecommitdiffhomepage
path: root/examples/models/models_skybox.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-18 01:24:00 +0200
committerRay <[email protected]>2019-05-18 01:24:00 +0200
commit6332bc039878c870538ce4c1ce47d3caaf3a40c4 (patch)
tree7822b225e6e73f906d48f280691035265f73b587 /examples/models/models_skybox.c
parent5ef7beb0c509b61d2ccc913360fea4c446ff4d4c (diff)
downloadraylib-6332bc039878c870538ce4c1ce47d3caaf3a40c4.tar.gz
raylib-6332bc039878c870538ce4c1ce47d3caaf3a40c4.zip
Corrected issue with shader loading
When using FormatText() several times in same function, returned string is static and so, the same is returned, resulting in failures on shader loading.
Diffstat (limited to 'examples/models/models_skybox.c')
-rw-r--r--examples/models/models_skybox.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c
index 2d4d5710..d3369b70 100644
--- a/examples/models/models_skybox.c
+++ b/examples/models/models_skybox.c
@@ -11,12 +11,6 @@
#include "raylib.h"
-#if defined(PLATFORM_DESKTOP)
- #define GLSL_VERSION 330
-#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
- #define GLSL_VERSION 100
-#endif
-
int main()
{
// Initialization
@@ -35,13 +29,19 @@ int main()
// Load skybox shader and set required locations
// NOTE: Some locations are automatically set at shader loading
- skybox.materials[0].shader = LoadShader(FormatText("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
- FormatText("resources/shaders/glsl%i/skybox.fs", GLSL_VERSION));
-
+#if defined(PLATFORM_DESKTOP)
+ skybox.materials[0].shader = LoadShader("resources/shaders/glsl330/skybox.vs", "resources/shaders/glsl330/skybox.fs");
+#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
+ skybox.materials[0].shader = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/skybox.fs");
+#endif
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MAP_CUBEMAP }, UNIFORM_INT);
// Load cubemap shader and setup required shader locations
- Shader shdrCubemap = LoadShader("resources/shaders/cubemap.vs", "resources/shaders/cubemap.fs");
+#if defined(PLATFORM_DESKTOP)
+ Shader shdrCubemap = LoadShader("resources/shaders/glsl330/cubemap.vs", "resources/shaders/glsl330/cubemap.fs");
+#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
+ Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs");
+#endif
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT);
// Load HDR panorama (sphere) texture