moderngl-window
moderngl-window copied to clipboard
Look into supporting #include for shaders
We should look into supporting #include
for shaders.
#version 330
#include utils/functions.glsl
...
Need to figure out how to handle line numbers.
Done. Need to document this. We can include up to 100 levels of sources as max sanity check.
utils.glsl
// A bunch of functions
library.glsl
#include path/to/utils.glsl
#incluide path/to/utils_2.glsl
#incluide path/to/utils_3.glsl
...
test.glsl
#version 330
#include path/to/library.glsl
#include path/to/something_else.glsl
Example : https://github.com/moderngl/moderngl-window/blob/master/examples/advanced/shader_includes.py
Seriously considering revamping this one a bit.
For some reason this seems to run into problems with includes of the form #include "somepath/somefile". In particularly when trying to include the lygia shader library and the cnoise function for example.