aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_shader_demo.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-20 10:41:34 -0400
committerDavid Robillard <d@drobilla.net>2022-05-20 13:17:45 -0400
commit1118da579607bac768ae953fecadb6153818488d (patch)
tree67ff1ae9f7400be070ee30284b5d0bcdbb834b22 /examples/pugl_shader_demo.c
parentd6ad1b79b97974ad3e3bd2a1b2c7474f0dd797b0 (diff)
downloadpugl-1118da579607bac768ae953fecadb6153818488d.tar.gz
pugl-1118da579607bac768ae953fecadb6153818488d.tar.bz2
pugl-1118da579607bac768ae953fecadb6153818488d.zip
MacOS: Build examples as application bundles
This is required on MacOS to make the examples usable. When run as bare programs, they don't show up as normal windows or receive keyboard input.
Diffstat (limited to 'examples/pugl_shader_demo.c')
-rw-r--r--examples/pugl_shader_demo.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c
index f4679e2..a2f3589 100644
--- a/examples/pugl_shader_demo.c
+++ b/examples/pugl_shader_demo.c
@@ -39,6 +39,12 @@
#include <stdlib.h>
#include <string.h>
+#ifdef __APPLE__
+# define SHADER_DIR "../"
+#else
+# define SHADER_DIR "shaders/"
+#endif
+
static const int defaultWidth = 512;
static const int defaultHeight = 512;
static const uintptr_t resizeTimerId = 1u;
@@ -284,16 +290,17 @@ setupGl(PuglTestApp* app)
}
const char* const headerFile =
- (app->glMajorVersion == 3 ? "shaders/header_330.glsl"
- : "shaders/header_420.glsl");
+ (app->glMajorVersion == 3 ? SHADER_DIR "header_330.glsl"
+ : SHADER_DIR "header_420.glsl");
// Load shader sources
char* const headerSource = loadShader(app->programPath, headerFile);
- char* const vertexSource = loadShader(app->programPath, "shaders/rect.vert");
+ char* const vertexSource =
+ loadShader(app->programPath, SHADER_DIR "rect.vert");
char* const fragmentSource =
- loadShader(app->programPath, "shaders/rect.frag");
+ loadShader(app->programPath, SHADER_DIR "rect.frag");
if (!vertexSource || !fragmentSource) {
logError("Failed to load shader sources\n");