cuinjune / Ofelia

A real-time cross-platform creative coding tool for multimedia development
GNU General Public License v3.0
370 stars 21 forks source link

Support for #include #82

Open bazilmuzik opened 1 year ago

bazilmuzik commented 1 year ago

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

Jonathhhan commented 7 months ago

@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.