GLGraphics   3 comments

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.

Proscene example

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.saveTexCoords(0, “texcoords.bin”);
cube.saveAttributes(0, “attributes.bin”);

model.loadTexCoords(0, “texcoords.bin”);
cube.loadAttributes(0, “attributes.bin”);

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:
model.saveVertices(“verts.bin”, vertices);

Finally, the xml file that specifies a GLModel now can point to binary data files instead of listing coordinates explicitly inside the xml itself:

<vertices file=”vertices.bin”>

<texcoords unit=”0″ file=”texcoords0.bin”>

<texcoords unit=”1″ file=”texcoords1.bin”>

<colors file=”colors.bin”>

<normals file=”normals.bin”>

<attribs number=”0″ file=”attributes0.bin”>

<attribs number=”1″ file=”attributes1.bin”>


Posted March 4, 2010 by ac in Programming

Tagged with , , , , ,

3 responses to “GLGraphics

Subscribe to comments with RSS.

  1. Hi. Could a bundle of tutorials be made for people who don’t understand the library yet. The examples show a great library but not really how to learn to use it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: