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 http://www.webgltutorials.appspot.com/WebGLTutorial06 in java and javascript with full homebrew GL_Shaders. Think processing hits the sweet spot on GUI, adaptability, community, platform access, and extendability.
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.
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().