Visualization using the Sport-Jolt graphics engine

The HelloJoltJni app (introduced on the previous page) is simple, readable and complete. However, as a console app, its output is limited to text.

Text provides scant insight into what the physics simulation is doing. For most people, pictures are much easier to understand.

For the purpose of this tutorial series, I’ve created a graphics engine named Sport-Jolt (the Simple Physics-ORienTed engine for Jolt). Sport-Jolt enables us to visualize physics objects without adding much code to the tutorial apps. It is open-source, written in Java, and available from GitHub and Maven Central.

HelloSport

HelloSport is a direct conversion of HelloJoltJni into a Sport-Jolt app.

Details to note:

  1. The app is declared as a subclass of BasePhysicsApp.

  2. The app implements both abstract methods of BasePhysicsApp (createSystem and populateSystem), which are invoked automatically.

  3. BasePhysicsApp automatically loads the Jolt-JNI native library.

  4. BasePhysicsApp provides:

    1. the physicsSystem field to access the system and

    2. the visualizeShape() method to visualize the shape of a physics object.

  5. Whereas HelloJoltJni simulated one step at a time, HelloSport attempts real-time simulation.

Running HelloSport should open a window on your computer’s desktop and play a brief animation of a sphere falling onto a horizontal surface.

Pressing Esc should close the window and terminate the app.

Hereafter, all the tutorial apps will use Sport-Jolt. Additional features of Sport-Jolt will be introduced as needed.

Summary

  • Sport-Jolt is a graphics engine, created specifically for Jolt-JNI tutorials.

  • Sport-Jolt provides a simple toolkit for visualizing 3-D physics.