aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_gl3_demo.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-04-04 13:36:45 +0200
committerDavid Robillard <d@drobilla.net>2020-04-04 13:36:45 +0200
commitecc281c56a8c3c297cfd2f0b6d4671b2000efd9b (patch)
tree6cabb79d95f19da7fc89318fd2aacf5f18c0200e /examples/pugl_gl3_demo.c
parentac3036fd7343ce71377fbfecafd8ba672372a5b9 (diff)
downloadpugl-ecc281c56a8c3c297cfd2f0b6d4671b2000efd9b.tar.gz
pugl-ecc281c56a8c3c297cfd2f0b6d4671b2000efd9b.tar.bz2
pugl-ecc281c56a8c3c297cfd2f0b6d4671b2000efd9b.zip
Shader Demo: Factor out version-dependent GLSL header
Diffstat (limited to 'examples/pugl_gl3_demo.c')
-rw-r--r--examples/pugl_gl3_demo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/pugl_gl3_demo.c b/examples/pugl_gl3_demo.c
index f43592d..6f7ed91 100644
--- a/examples/pugl_gl3_demo.c
+++ b/examples/pugl_gl3_demo.c
@@ -259,6 +259,7 @@ setupGl(PuglTestApp* app)
}
// Load shader sources
+ char* const headerSource = loadShader("shaders/header_330.glsl");
char* const vertexSource = loadShader("shaders/rect.vert");
char* const fragmentSource = loadShader("shaders/rect.frag");
if (!vertexSource || !fragmentSource) {
@@ -267,9 +268,10 @@ setupGl(PuglTestApp* app)
}
// Compile rectangle shaders and program
- app->drawRect = compileProgram(vertexSource, fragmentSource);
+ app->drawRect = compileProgram(headerSource, vertexSource, fragmentSource);
free(fragmentSource);
free(vertexSource);
+ free(headerSource);
if (!app->drawRect.program) {
return PUGL_FAILURE;
}