My question is - how to import a library into OpenGL GLSL shader? I mean - is there a way that is supported by OpenGL itself, not a facade over the API which concatenates strings in order to mix shader code with a library code.
- Thx for your question and for the @MikeMx7f answer but it seems to me that there is now appropriate way to make glsl files somekind of moduluar. I also just posted an issue: stackoverflow.com/questions/20604221/….Diversity– Diversity2013-12-16 06:35:36 +00:00Commented Dec 16, 2013 at 6:35
1 Answer
There is no way that is supported by OpenGL itself without extensions. Many engines that wrap OpenGL add their own preprocessor to handle #include macros to solve this problem, but this qualifies as "a facade over the API which concatenates strings in order to mix shader code with a library code."
The ARB_shading_language_include extension provides an OpenGL version of this functionality, but may not be available on your particular machine. For an overview on this extension, see this question: How to Using the #include in glsl support ARB_shading_language_include