EXC_BAD_ACCESS and shaders

Hello!
Slowly starting to understand OFW. Thanks for all the posts in the forum, they are really helpful.
Now the question: I am currently working with shaders. I downloaded the examples from the addons page:
http://addons.openframeworks.cc/projects/show/ofxshader
The project compiles without any problem but every time i try to run it i get the next exception:
GDB: Program received signal ‘EXC_BAD_ACCESS’
I know this is related with memory protection, right?. I compiled the example as it is(only changed a reference on the ofRunApp method), so i am rather unclear what can be the reason for this problem. I have noticed that the compilation of some old OFW examples creates such situation. Am I missing something?
Thanks
Emmanuel

testShader.zip

I think you need to place the shaders in the same folder as your app, i.e. the bin folder.
This is not terribly well documented, and in future I there should be the option to load shaders from a given directory.

Thank you for the answer.
The original location of my shaders was:
/testShader/bin/data/shaders/

I have been trying different things:
1-changing the location of the shader
2-changed the XCode project by placing the shaders together with the source
3-modify the fragment shader so I could know if the problem is coming from the shaders:
gl_FragColor = vec4(1.0,0.3,0.1,1.0);

however, nothing so far has worked. Am i missing something here?

Herewith I attach a newer version of the project(It compiles but doesn’t run) and the warnings.

Thank you

testShader.zip

Any progress on this? I get the same errors.

Also the use of ofxShader seems to be a bit all over the place in the forum, some people use ofxShader and others ofShader from the addon page, very confusing …

Any help will be much appreciated!

Cheers
rS

hi,

i was able to replicate your error from your src. i believe the ofShader addon you downloaded is fairly old… once i switched to the ofxShader you have in the src folder, everything compiled and ran fine.
so, to fix your problem:

  1. change your include in testApp.h to
    #include “ofxShader.h”
    and change your ofShader temp variable to ofxShader temp
  2. give the correct path in load
  • should be temp.loadShader(“shaders/color”);
    since they are in the shaders folder
  1. change your setUniform function to the ofxShader syntax:
    temp.setUniformVariable1f(“time”, (float)timer);

that should be it!

Thanks robo!

I am not the author of the post but this help me a lot, It is compiling at last, now I need to study the code

Cheers
rS