Beginner to programming trying to grasp fragment shaders, long story

I’m sorry to bother you with my strange problem but I can not figure it out myself.
I have been learning processing , not the concept, the simple “programming language”
And I’m beginning to get the hang of it and achieving some cool things, and the latest one is running slowly.
Not surprisingly as I’m running nested loops which adds up to millions of operations per frame running on a single core.
There’s a lot of things that could be done in parallel though, and one promising technique seems to be GLSL
There’s a catch though, I don’t know anything about opengl or glsl…
Well that’s true but I had another catch in mind which is persistency, not indefinately but data written and stored for a couple frames.

So I’ll try to explain what I mean by explaining something else, which is vaguely related to what I’m ultimately trying to do but simpler,
and something I’m considering coding just for the sake of learning something about the language.
So, the “simple” thing is persistent post-processing anti alias.
So what do I mean by that?
That the shader writes it’s result somewhere accesible rather than just gl_FragColor.
And the next frame it reads the previous state and does another pass.
So visually the output would get gradually blurrier over time, rather than being static as would be the case if every frame started of unprocessed.
I understand that graphics cards has a certain purpose and that there is limits to what you can do with them…
And it seems this is not what they’re designed to do, but could possibly be tricked into doing.
I have a stupid idea that could possibly work… catch the result from the framebuffer with cpu and feed it back to the shader as a texture.
I don’t think it would work though, it would probably be too slow, create artifacts or crash.
Maybe it could be worked aroung using framebuffer objects?
Or a shader storage buffer object?
Or some better technique I’m totally unaware of.
As I said I’m very new to this and I haven’t figured out how to even load a texture into a fragment shader as a read-only uniform yet.
Just been able to display simple gradients from a shader in processing, using the guide thebookofshaders that I started reading today.
But I can’t figure out what to do beyond that.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.