Ofelia icon indicating copy to clipboard operation
Ofelia copied to clipboard

Support for #include

Open bazilmuzik opened this issue 1 year ago • 1 comments

There's this wonderfull glsl library called lygia (https://lygia.xyz/) which comes with a ton of incredible utilities, functions, etc.

However it relies heavily on #include that Ofelia doesn't recognize... Or at least I don't know how it could be... In the attached folder, there's a small example. If you use the command

glslViewer test.frag

It all works fine. The random.glsl file (coming from lygia) is recognized and applied correctly with

#include "random.glsl" (line 5 in test.frag)

But using test.pd, I get this error message when creating the window:

ofShader: GL_FRAGMENT_SHADER shader reports: 0:5(1): preprocessor error: include "random.glsl" not found

On the lygia page, there are many examples on how to implement #include in different cases/languages, including C# and C++ (see the "Design Principle" section). That makes me think, without being a developper, that it should be possible to make it work for Ofelia...

What do you think ?

Thanks in advance

test.zip

bazilmuzik avatar Aug 28 '23 12:08 bazilmuzik

@bazilmuzik I guess you need to include all the bindings with swig before compiling the external. Here is my attempt: https://github.com/cuinjune/Ofelia/issues/91

#include inside the PD patch is not possible.

Jonathhhan avatar Apr 14 '24 23:04 Jonathhhan