Rendering question

edited May 2014 in How To...

Hi, I don't know if this is the best section to post, maybe it should be the GLSL, so sorry in advance. I'm quite familiarized with processing, but I want to dig deeper in the advanced stuff.

For comparisons, let's assume I want to do a heavy processing operation, like applying a big kernel on an image, or maybe making a lot of per pixel operations on a huge image.

What is the fastest way to render the result in native processing? Until now I've researched some ways but is very confusing and I can't fully understand them...

  • I know a good way is to use PGraphics to draw off screen and then show later as a PImage. Is this really the best way?
  • To speed up, should I use P3D? (I'm running Processing 2.0.1 - Mostly 2D photo-manipulation operations).
  • Should I use P3D WITH PGraphics? (Again, 2D only)
  • How about PShader, can it be used in this case?
  • Does Processing (2.0.1) automatically uses the GPU to render the sketches?
  • Is an older version of Processing faster for this kind of operations?

How about non native Processing solutions (I.E. external libraries), is GLGraphics the best alternative to render with the GPU?

I've come across Amnon's site, he uses GLGraphics , but since Processing's version was not 2.0, I don't know if those improvements are already included.

Does the same solution applies for 3D sketches?

I know it's a lot of questions and this is not a basic topic, but any help is much appreciated!

P.S.: What happened to Amnon, every time I visit his page I find myself questioning why he stopped updating it... His brainstorms and explanations are awesome, does he has another site...?

Thank you very much in advance!

Answers

  • If you are going to apply a custom filter on an image using PShader will give you the best performance. If you don't have experience using shaders then I would recommend using PGraphics for manipulating the image.

  • Ok, I've haven't read about shaders yet (the article is immense), but I will. So I can do all the normal processing operations using PShader, like the usual image processing filter convolution?

    Aside from this specific operation, is PShader always best practice for fast rendering? Another application would be lots of particles on the screen (I bet you are thinking: "wow, SO original rolls eyes")

    Are there other tricks? I accidentally played with P2D instead of the default renderer and it gave me a solid boost in speed, this is NOT trivial, the "size()" reference page do not mention this (although it says you may use P2D, P3D, pdf and default).

Sign In or Register to comment.