Using #include inside shaders?
Posted: Sat Apr 30, 2022 11:50 pm
How can I #include or require() one glsl shader inside another in love2d so I don't need to copypaste common functions between shaders?
I use:
and I get:
> ERROR: '#include' : required extension not requested: GL_GOOGLE_include_directive
This answer hints that I need to set an include directive to enable the feature. I tried this and it seems to accept it:
But gives a new error:
> '#include' : Could not process include directive for header name: ladybug.glsl
I'm not sure what to do with that error message. ladybug.glsl is in the same directory as the current shader. I also tried the path from the folder containing main.lua.
This thread implies that I need to use a shader compiler, but what's the point of the include directive if that's the case?
I use:
Code: Select all
#include "ladybug.glsl"
> ERROR: '#include' : required extension not requested: GL_GOOGLE_include_directive
This answer hints that I need to set an include directive to enable the feature. I tried this and it seems to accept it:
Code: Select all
#extension GL_GOOGLE_include_directive : require
#include "ladybug.glsl"
> '#include' : Could not process include directive for header name: ladybug.glsl
I'm not sure what to do with that error message. ladybug.glsl is in the same directory as the current shader. I also tried the path from the folder containing main.lua.
This thread implies that I need to use a shader compiler, but what's the point of the include directive if that's the case?