GLGraphics 0.9.9   Leave a comment

This release of the GLGraphics library includes several fixes and a few additions. It sets all the features expected to be available in the final 1.0 release, with the exception of some new examples that I didn’t manage to include in this release. Download here and keep reading for more details.

This release was prepared in parallel with the ongoing development of the A3D renderer for Processing Android (which is looking pretty good, hopefully I will update about it soon), so most improvements are the result of backporting fixes and new features from A3D. The key enhancements of GLGraphics 0.9.9 are the following:

  • Completely reworked mechanism for releasing OpenGL resources (textures, vertex objects, shaders, etc). These resources are now automatically deleted when the sketch is closed. Alternatively, they can be manually de-allocated during the execution of the sketch by using the delete() method available in all the classes that encapsulate an OpenGL resource: GLTexture, GLModel, GLTextureFilter, GLModelEffect, GLSLShader, GLCgShader and GLCgFXEffect.
  • The point sprite mode in the GLModel class allows to properly set the size of the sprites depending on the distance to the camera. OpenGL calculates the sprite size using a distance attenuation function with several parameters, and GLModel offers a couple of methods to control this attenuation function more easily:

    model.setSpriteSize(20, 400);

    This code sets the maximum sprite size to 60 pixels, and adjusts the distance attenuation so that the sprite size is exactly 20 when the distance to the camera is 400. The actual attenuation function is s = smax / (1 + c * d * d), where smax is the maximum sprite size, d the distance to the camera, and c the adjustable constant. The dependence on d is quadratic in the denominator, there is the option to make it linear by passing false as a third parameter to setSpriteSize(). True is the default value and corresponds to the quadratic case.

  • Additional blending modes: REPLACE, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION and SCREEN, which should work similarly to their counterparts in P2D or P3D. The blending mode is set from the GLGraphics renderer by calling setBlendMode(). GLModel and GLTextureFilter have their own, separate blending mode that can be set using GLModel.setBlendMode() and GLTextureFilter.setBlendMode().

As for longer terms plans, GLGraphics 1.0 would be the last version providing a stand-alone renderer, since all the OpenGL-based drawing has been implemented in the A3D renderer. A3D is in the process of being ported over to the new OPENGL2 renderer on the desktop, and I will be covering this porting in more detail in future posts. But with regards to GLGraphics, I expect to keep a 1.x branch for maintenance purposes, while a potential GLGraphics 2 would concentrate on advanced rendering features such as texture filters, shaders, and material effects, to be used in combination with the upcoming OPENGL2 renderer.


Posted December 14, 2010 by ac in Programming

Tagged with , , ,

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: