[Library/Games] Java OpenGL based graphics engine

Two years ago I wanted to replace the engine of an old game I reverse engineered with a more modern one, but writing the whole new engine into the game seemed like a waste to me so I wrote this graphics engine. It has API’s for low level OpenGL features and is based on LWJGL, but also includes very high level interfaces which allow you to construct an application without knowing anything about OpenGL or computer graphics.

It consists of several layers of abstraction, the lowest layer wraps basic GL operations such as managing and encoding buffers of geometric data and integrating their deallocation into the Java GC to prevent OpenGL server memory leaks.

The layer above that very lowest layer manages objects in a scene graph, in which every object (which can be rendering objects, cameras, effects etc.) is based on a Node superclass which provides methods for managing their position in the scene graph, this layer also contains two special kinds of Node implementations: Camera and GeometryNode.
Camera provides a customizable camera which by default uses perspective projection and allows for extra rendering configuration to be done using RenderControl instances, changing properties of the camera not exposed through setter methods is possible by overriding methods like updateProjectionMatrix().
GeometryNode is a base class for objects that render geometry or do other operations affected by the modelview matrix, it sets up the modelview matrix in such a way that any operations done within renderGeometry(Camera) will have their results positioned at that Node‘s position in the world.

The next level above that is mainly for simple programs that do not really need to utilise the power of the lower level API’s and simply need a way to show some nice looking 3D objects. It provides a base class for the application, SimpleApplication, which takes all the complicated things like initializing the engine and implementing a main loop which does all necessary calls to get the image rendering. The CameraControl framework is also part of this layer, it provides a simple way of adding ,for example, a first person camera to your application.


GitHub project

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>