When designing objects to be placed in an OpenGL world space, how are the world space coordinates stored with their corresponding objects/models?
I’ve been using Wavefront Object files for simplicity and I’ve heard of Collada but haven’t been able to find any standard method of saving a world space, as one might if designing a game level.
I am very new to OpenGL.
A world position, rotation and scale can always be defined as a 4×4 matrix, but it loses some information if you just store it in one matrix. Therefore, the three matrices are stored separated like so:
The rotation is quite hard to store in only a single matrix. So most of the time, we use the Quaternion to store a rotation, because it is easier to understand what it does and complies to better calculations. There is a lot that I could explain about gimbal locks (movie), but you probably need a reference guide for matrices and a good openGL math library that contains these data types.
Since OpenGL is not an engine that has some basic GameObject that you can use, you will have to create that class yourself (assuming OOP here). Store the world data in these objects and draw them in the appropriate order. You should not save world data into the 3D model, since you can instantiate multiple objects of the same model (multiple enemies that look the same).
Here is a tutorial that shows you how to create a basic engine.