We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey, I'm porting pmneila's really nice web reaction diffusion project (https://pmneila.github.io/jsexp/grayscott/) to Processing with shaders. However, I can't, for the life of me, get the fragment shader to compile. The loadShader() call works, but as soon as I try to set my first uniform, the program crashes with "Cannot link shader program: Unknow error". Yes, with the typo and all. Here's my shader:
https://github.com/abigpotostew/reaction_diffusion/blob/master/reaction_diffusion_shader/data/grey_scott.glsl *Edit, changed code to link to github since formatting was all jacked up.
I can't figure it out, if you know what's going on, let me know. Thanks.
Here's the Processing sketch which crashes on line 18 https://github.com/abigpotostew/reaction_diffusion/blob/master/reaction_diffusion_shader/reaction_diffusion_shader.pde
Answers
Ok, there are a bunch of things wrong, both in your sketch and your shader code. You should take a look at the shader examples that come with Processing. Also, shader debugging sucks, so it's best to do a lot of incremental development. Your sketch is overcomplicated and you use a PVector before it's initialized. Your shader uses vec2 vertTexCoord, where it should be vec4 vertTexCoord and doesn't use texOffset.
Adapted Sketch
Adapted Shader
Thanks so much amnon! I overlooked the texOffset uniform while looking over the shader tutorial. And I didn't know filter() existed at all. I am new to working with shaders in processing. Thanks for parting some wisdom on me.