Please help this old fart get his Processing 1.5 rendering code to the present day?

edited November 2014 in How To...

Resisting change, I have been unwilling to jump on the Processing 2.0 band wagon in fear of having to learn something new, and change my ways. As a digital Amish person, I've been stubbornly milking my PGraphicsOpenGL objects and loading my tables using the old fashioned ways.

Until now.

You see, I actually really do want to live in the future. I've got electricity, internet, everything. So please help me solve the following issues:

(1) Blend modes & depth sorting

Whenever I port my code, and try and upgrade a custom opengl blending override from say:

  PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
  GL gl = pgl.beginGL();

  gl.glDisable(GL.GL_DEPTH_TEST); 
  gl.glEnable(GL.GL_BLEND); 

  gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);

  pgl.endGL();

to:

  PGL pgl = beginPGL();
  gl = ((PJOGL)pgl).gl.getGL2(); 

etc...

I don't get the blending to work the same way as before - that is to say, it doesn't seem to disable depth testing and do a brute force additive blending from any perspective. I get horrible texture clipping artifacts etc. Using the sparkly new blendMode(ADD) function yields the same results, nor does hint(DISABLE_DEPTH_TEST) seem to do anything.

Any ideas?

(2) Performance

A simple sketch running through 360x180 vertices using beginShape(POINTS) with the sketch set to OPENGL breezes through running 1.5, but seems to really struggle running 3.0 Alpha 2. What's going on? Any buttons I forgot to press? I set the thing to noSmooth() in 3.0 even (whilst doing hint(ENABLE_OPENGL_4X_SMOOTH) in 1.5).

??

I'm sure I'm ignorant due to my absence on the boards in the past few years (for which - my apologies!) Ideas and any sort of help much appreciated!

T

Answers

  • edited September 2014

    The two most important additions are PShape and PShader. The former can be used to store geometry for fast display on the GPU. The latter can be used to run GLSL shaders for all possibile graphics effects and filters. Luckily both have a tutorial, which may be a good start to get up to speed with the current Processing again...

  • Thanks Amnon. My apologies for not coming back to you earlier, but it seems email notifications were off. Both these new additions are very exciting, and exactly the reason I want to move on. However, the clipping issue is preventing me currently to jump ship. Also, why would Processing be slower doing the exact same thing it used to do?

    No doubt the use of vertex buffers and shaders will speed things up, but do you have any idea about the above?

  • Hey guys, amazing job on Processing 3.0 - I'm almost there :-)

Sign In or Register to comment.