JOGL with Gradle

Here is a simple build.gradle file for a JOGL project.

apply plugin: "java"
apply plugin: "application"

mainClassName = "ben.Main"

repositories {
    jcenter()
}

dependencies {
    compile "org.jogamp.gluegen:gluegen-rt:2.3.1"
    compile "org.jogamp.jogl:jogl-all:2.3.1"

    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-android-aarch64"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-android-armv6"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-linux-amd64"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-linux-armv6"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-linux-armv6hf"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-linux-i586"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-macosx-universal"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-solaris-amd64"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-solaris-i586"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-windows-amd64"
    runtime "org.jogamp.gluegen:gluegen-rt:2.3.1:natives-windows-i586"

    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-android-aarch64"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-android-armv6"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-linux-amd64"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-linux-armv6"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-linux-armv6hf"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-linux-i586"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-macosx-universal"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-solaris-amd64"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-solaris-i586"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-windows-amd64"
    runtime "org.jogamp.jogl:jogl-all:2.3.1:natives-windows-i586"
}

Without the runtime dependencies it will throw unsatisfied link errors.

Advertisements

I’ve been having fun

Since my last post I’ve been quite busy.

  • I’ve added quite a few new features to the engine and editor.
  • Terrain, and terrain generator that uses perlin noise.
  • Lighting, not completely finished, but add a new dimension to the scenes.
  • The ability to load nodes from files, and save them.
  • I have completely separated the engine from the editor.
  • I have a few steps to get meshes from blender into my own format, and have used them to convert a bunch of building models.
  • And a lot of bug fixing.

Screenshot

Particle System

I have added a very simple particle system node to the engine, they are just rendered as sprites, and they don’t even face the camera yet 🙂

I’m also working more on the editor so that it can actually edit stuff.

Particle System

Scene file format

I have decided to use my own file format for saving scenes, rather than using xml, and I’m very happy with the results.

A simple scene…

Node rootNode
CameraNode camera 0 0 500 0 0 0 End
PlayerNode player 10 0 0 0 0 0
MeshNode playerMesh data/spaceship.mesh End
End
End

Basically each node controls what it wants to save and load.

And here is the scene…
Screenshot

The Renderer

At the moment the renderer is very simple, it has a pointer to a camera, and a list of pointers to all the renderables. The list will be simply sorted, not based on states or anything too complex, just how it needs to be sorted to render correctly, like the transparent objects together, the skybox at the start etc…

Only OpenGL, and I will be using extensions, I have a graphics card that supports OpenGL 3.0, so that will be the standard, I don’t want to be writing hacks to get it to work with every card on the market. At the moment the mesh’s use VBO’s.

The Scene

The scene graph is composed of nodes, where each node can hold any number of sibling nodes.

Each node has its own world translation matrix, and certain nodes have a local translation matrix. When a node is translated or rotated, its local matrix is updated, then its world matrix is updated by doing a multiplication between its parents world matrix and its local matrix, and finally all its children have their world matrices updated.

The nodes that I have created so far.

  • Transformation Node
  • Animation Node
  • Camera Node
  • Player Node
  • Mesh Node
  • The Editor

    The editor uses the Qt toolkit, and was written using the brand new QtCreator, which is beautiful, although still missing a few features.

    The main render is done on a QGLWidget, which works nicely, and OpenGL extensions are done using glew, which works nicely.

    I have created a tree view to visualise the scene graph, this has been done through inheriting from a QAbstractItemModel. Using this model, I can update my scene graph as normal, and the tree view will update automatically. This view allows for selecting the nodes, and will allow properties to be altered depending on the selected node.

    Next to be added, will be the ability to select the nodes by clicking on them in the render widget, and also a set of visual widgets to translate and rotate nodes.