Thanks to the contributions from Jean Pierre Charalambos and Aaron Koblin, I finished a new version of GLGraphics with a couple of very useful additions, plus some bug fixes as well. Download the library package from sourceforge.
Jean Pierre, artist and computer graphics professor from the Universidad Nacional de Colombia, started coding up a set of viewport manipulation classes into GLGraphics, based on the libQGLViewer library for C++. These classes allowed for intuitive interactive camera manipulation and hierarchically-linked frames of reference, and they eventually evolved into a full fledged, stand-alone Processing library, which is called Proscene and can be downloaded from its google code homepage.
Although GLGraphics is not required for Proscene to work (you can use Proscene with any 3D renderer in Processing such as P3D or OPENGL, besides GLGraphics), I bundled Proscene with this release of GLGraphics anyways since it is very convenient addition for handling 3D viewing. Also, to make people aware of this fantastic library, which they can download separately in the case they don’t need GLGraphics. Proscene’s examples are also included, as well the API reference, which can be accessed online as well.
Aaron, who has made numerous suggestions regarding the GLModel class during the past few months, this time contributed code to save vertex coordinates into binary files, which speeds-up considerably access times particularly for models composed by many points. Vertices, colors, normals, texture coordinates and generic vertex attributes can be saved and loaded separately:
model = new GLModel(this, “model.xml”);
Model data stored in binary files can be loaded into array lists for additional manipulation before copying into a GLModel:
// Method GLModel.getVertices() loads data from binary file and returns into array list of PVectors,
// but doesn’t load into model:
ArrayList vertices = model.getVertices(“verts.bin”);
for (int n = 0; n < vertices.size(); n++) ((PVector)vertices.get(n)).mult(6);
// Saving array list back to disk, and then updating model with it:
Finally, the xml file that specifies a GLModel now can point to binary data files instead of listing coordinates explicitly inside the xml itself:
<texcoords unit=”0″ file=”texcoords0.bin”>
<texcoords unit=”1″ file=”texcoords1.bin”>
<attribs number=”0″ file=”attributes0.bin”>
<attribs number=”1″ file=”attributes1.bin”>