Monday, February 27, 2017

Orbital Aero Model: OpenGL Visualization

A few of my self imposed requirements for the Orbital Aero Model is to be cross-platform compatible (Windows, Linux, and Mac) and to use as few as possible (and as small as possible) external dependencies.

Cross-platform compatible for the obvious reasons that I'm not limited to any one OS. It'd be fun to build a cluster of Raspberry Pis that crank out a bunch of orbital maneuver simulations simultaneously.

And I've encountered first hand how difficult dependencies become as projects get larger, so I'm making a concerted effort from the beginning to keep them under control. Plus this project is just as much an excuse to learn new concepts as it is to produce a working product; if I use Unity to handle all physics, control inputs, and visualization then I'm learning that tool rather than how that tool does what it does. (If your goal is to just make games, then learning the Unity tool is probably a great way to go.)

It has been easy so far using standard C++ libraries to create the core orbital mechanics simulation. Despite seemingly every answer on Stack Overflow suggesting a Boost library to solve a problem, I've successfully avoided it as well. (Not that I have anything against Boost and I'm glad its capabilities make their way into the C++ standard, but it has 27,488 header files alone! That is far from a small dependency.)

OpenGL is the inevitable choice for cross-platform 3-D rendering. This I found to be the point where dependencies couldn't be avoided. I chose to develop on OpenGL 3.3 as it had major changes over 2.X and I'd like to learn on the modern / actively maintained API (without going cutting-edge Vulkan). The site https://learnopengl.com/ has been an amazing resource.

My dependencies have added up to include:
OpenGL - Base Graphics Library
GLFW - Window, Input, and Event Management
GLEW - OpenGL Extension Functions
GLM - OpenGL Math Functions
SOIL - Texture Import Functions
ASSIMP - Asset Import Functions

I love SFML (Simple and Fast Multimedia Library), but it's 2-D only so that doesn't help me with the graphics drawing and its input functionality is covered by GLFW. If you are planning on 2-D only application, then SFML is a great pick.

I don't have any code ready to share at this time, but I do have pretty screenshots! I'm still trying to gather a library of 3-D models that will show off the aero model. The following screenshots use Nicola Cornoiti's Moon model

Screenshot of the Earth (using the moon 3-D model) with the moon in the background:


After a period of time:


Video of the moon orbiting the Earth:


And for fun, how about the 3-D billiards example:

Video from the side...


Same scenario but repositioning the camera...


Still shots of the billiards:

1...


2...


3...


No comments:

Post a Comment