More and Faster: glInterleavedArrays glDrawArrays

Anyone have pointers as to how I might move toward being able to use the array functions from openGL (glInterleavedArrays and glDrawArrays) within processing? Am ok if this involves my needing to develop a library. Google searches on processing “glInterleavedArrays” returned nothing.

Initial application space is converting my present capability to show CNC tool paths. This is a full 3D slider<==>time pseudo VCR of the developing trenches in the material as the bit passes through. Current code is in C++. Used the glInterleavedArrays and glDrawArrays techniques to avoid calls to methods for every point in the fairly extensive TRIANGLE_STRIP’s.

My Background: Started as a course III. Wrote a 3D fly-thru openGL C++ app for all 100K wires in an IBM mainframe. Wanted to do web stuff so wrote in java and javascript with full homebrew GL_Shaders. Think processing hits the sweet spot on GUI, adaptability, community, platform access, and extendability.

Hope to help.

1 Like

@TPMoyer – this sounds great. You should also post a hello in Please Introduce Yourself

IANA expert in openGL, but we do have a few on the forum – for example, I believe @gohai is quite experienced with this and has written Processing + openGL libraries. Hopefully someone can suggest starting points.

I wish I knew anything about GL - I am just an occational plumber.

I would suggest looking directly at the source code of Processing’s P2D/P3D renderer, to see if it provides access to what you want to use. You find the files here. Compiling and runnig a modified version is also surprisingly easy, as you only need a recent JDK and ant installed (the a link in the Readme on Processing’s Github project has more information about that).

The linked P2D/P3D renderer makes use of the JOGL library, which makes it possible to call the GL C API from within Java. So you could attempt to add missing functionality by adding the necessary methods or classes in P2D/P3D.

1 Like

beginPGL probably gives access to the required functionality, but if not you can directly access JOGL from it - see

It’s quite easy to extend the P2D/P3D renderers to add additional functionality without having to fork core Processing.

It’s also worth looking at PShape with the GL renderers, or at least the code of.

Good pointers!
Got this up and working by riffing off the examples/Demos/Graphics/LowLevelGLVboInterleaved.
Shared this as github

Did not need to recompile the Processing source.

The prior example showed how to use the beginPGL structures to
invoke shaders,
set up both the to-be-drawn data and the shader variables
push data to the GPU
launch a single method DrawArrays() call to roll through all the data.

How might one nominate a sketch for inclusion in the distributed examples? 

The present code should enable substantially faster rendering than the prior published example. It avoids the needless re-calculation and of the dataset for each Draw(), and avoids the needless data movement from the CPU to the GPU for each Draw().

1 Like

Regarding distributed examples, I believe you can just put the sketch in a pull request to the examples repository.

I believe this (with the xml index) is used to build both the examples in PDE and the examples on the website.