Converting other GLSL shaders into PShader format

Hi I'm trying to convert this DOF shader into something that works in Processing as a PShader http://devlog-martinsh.blogspot.co.uk/2011/12/glsl-depth-of-field-with-bokeh-v24.html

I created a frag.glsl with the code in it, I have 2 textures, a regular render, and a depth buffer, which I pass to the two textures inside the shader.

I have barely an idea what I'm doing... when I run the sketch I get compile errors such as 'undeclared identifier gl_TexCoord'. There's probably lots more I need to do as well - any help appreciated, thanks.

Answers

  • Answer ✓

    I am a beginner on shaders too. :) To know something about how shaders work, I recommend this Processing tutorial (probably to Processing 2.x, I'm not sure if it is properly updated) and this generic text.

    gl_TextCoord looks like a OpenGL standard variable, but I think it is only valid on a pixel shader (your frag shader). So, you are sure that you don't mismatch the parameters on loadShader()? You offer the arguments on reverse order related to the pipeline: first your frag shader and so your vertex shader.

Sign In or Register to comment.