Shaders and folders structure

Hello everyone,
I am having problems running an app which uses some shaders.
The app works nicely if it’s located in the OF folder but when I remove it from there, the app works and run but the shaders don’t.
I tried to put the app in the same folder level of the original OF apps structure but it didn’t work.

I don’t understand why only the shaders have problems even if the folder structure is the same.

Any hints or idea is very much appreciated!

thanks!

Hi Antocreo,

Usually the path where files (images, shaders, etc…) are located is in the /data folder.

So the structure should be no matter where it is located:

AppFolder/App.exe
AppFolder/data/shader.vert
AppFolder/data/shader.frag

Hi Hennio,
the structure is as you say, only thing I have the shaders in a subfolder (shaders). Moving them up of a level doesn’t fix the thing.

AppFolder/App.exe
AppFolder/data/shaders/shader.vert
AppFolder/data/shaders/shader.frag

I tried to put the same thing on another machine, with OF installed, and even if I put it in the same folder the shaders don’t work. I still can’t figure this out… :frowning:

p.s.
I am on OSX, Xcode 6.2. OF 084

Can you post working and not working examples? Code + folder location etc…

Hello Hennio,
thanks for getting back again.
I spent some time running few tests, checking different options. I found out the problem was an addon I am using (ofxLayerMask) which uses its own shaders. So, when I was moving the app+data folder in another location, it was missing the addon shaders.
I copied both app+data and addon folders, keeping the same folders depth and now it seems to work. (see png attached)


So, now, the new questions:
is it there any way to create an app that contains all of those folders?
is it there a way to avoid copying the addon?

thank you!

The best thing to do is check out what is ofxLayerMask doing to find those shaders. I assume that if its looking for the shaders in its own addon folder its doing something like shaderPath = “…/…/…/addons/ofxLayerMask/src/shader/” blabla…

If you find this in the addon code, you can change it to something more convenient for you, such as shaderPath = “./shaders/” which is where all your shaders are, so you do not depend on the folder structure. (note that shaderPath is just an example im making up, you will have to scan through the addon code to know how it is finding the shader)

After changing the shader paths you can simply copy the shaders in the addon to your folder, so it is all self contained.

Hello Hennio,
I will check what you suggest as soon as I can. Thanks for support and hints! I will let you know!
Cheers :slightly_smiling: