We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello Team,
I feel foolish that I can't figure this out. I am literally copying the code example from the processing reference for blur.
https://processing.org/reference/PShader.html
And, I get this error in Processing 3 and 2).
"Cannot compile fragment shader: ERROR 0:9 '<' : syntax error"
I must be missing something simple yes? :)
PShader blur;
void setup() {
size(640, 360, P2D);
// Shaders files must be in the "data" folder to load correctly
blur = loadShader("blur.glsl");
stroke(0, 102, 153);
rectMode(CENTER);
}
void draw() {
filter(blur);
rect(mouseX-75, mouseY, 150, 150);
ellipse(mouseX+75, mouseY, 150, 150);
}
Answers
Some examples in https://processing.org/tutorials/pshader/
or
https://forum.processing.org/two/search?Search=loadshader
I dunno much about this example or about shaders. If you decide to try any of those in the above links, make sure you have the fragment (and vertex if any) shader in the sketch directory level (which is accessed via ctrl+k in your sketch).
Kf
Hm. I can not reproduce it.
Hello @kfrajer and @nabr,
Okay, I found the example and looked through the resources you sent - solved it with your help. Thank you!!!!
Sincerely,
Margaret
@nabr That example in the Processign website... ehhh I don't think it is the best. Calling the filter(blur) suppose to be a demo of shaders? I was puzzled first about where to get the glsl files from. Are you familiar with how filter relates to shaders by any chance?
@mnoble From the following link: https://processing.org/tutorials/pshader/
Later in the same document, it says:
This last is important. If you get a shader from another source, you need to adapt it to Processing guidelines. Processing allows to manipulate and run shaders without going through all the exercise of setting up all the bits and pieces to do so. More info next:
I suggest you have a look at the 6.1 and 6.2 examples presented in the link above. I am not familiar with shaders, I can only help whenever I can (and I know)...
Kf
Hi @kfrajer -
Thanks for taking some time here and making recommendations!!!
As I work through this problem and am pleased to be with getting somewhere with the blur, I just sadly realized that I am on the wrong path (I think). I want to blur moving images and I it looks like that is a whole another beast from the tutorial:
https://processing.org/tutorials/pixels/
Please correct me if I am wrong! Anyhow, now I have a new host of new problems for my project! I suppose I should post in a new thread :)
Check related post: https://forum.processing.org/two/search?Search=postfx
For instance:
https://forum.processing.org/two/discussion/comment/110331/#Comment_110331
https://forum.processing.org/two/discussion/comment/100296/#Comment_100296
https://github.com/cansik/processing-postfx
You could get more feedback (most of the time) if you provide an MCVE supporting your questions.
Kf
@kfrajer I had to look up "MCVE" - glad I know now! Thanks for everything, will do!
@kfrajer
https://processing.org/reference/PShader.html
is related to the Processing Exampels, if you are unhappy make a pull on github :)
Processing filter() is a Shader. You render your scene (from so called framebuffer) to a texture, then you map this texture to your window as (fullwindow) quad, and with this texture you do your image processing steps.
In case of a blur filter, (their are many solutions but the most common is) you create a convolution matrix and shift the x,y positions of pixels according to it's neighbours.
@mnoble
Yes a shader is a hole new world, when you came from Java CPU background, but only at first sight, it's an other programing language, underneath you have to do the same math.
CPU
GPU
JOGL is the language that send data from CPU to GPU.
And GLSL (OpenGL Shading Language ) is the language that takes the data and instruct the GPU to perform specific tasks.
https://en.wikipedia.org/wiki/Graphics_pipeline#Shader
sounds like you are searching for
https://www.google.de/search?q=Motion+Blur
@nabr thanks for the tip and all the details! So much to learn, much appreciated!!! :)