I'm trying to render a "skybox" using Allegro 5, that 3D objects can move around "in front" of. I'm having trouble figuring out how to set up the projection transform and where to put the vertices for the quads that will have the background texture applied.
The plan is to use an orthographic transform the size of the skybox textures to place the quads, and only use rotation for the camera. Once the skybox is placed the depth buffer bit will be cleared and other objects perspective-transformed from their respective world-coordinates as normal.
The orthograpic transform API has the form
void al_orthographic_transform(ALLEGRO_TRANSFORM *trans,
float left, float top, float n,
float right, float bottom, float f)
while the struct which holds the vertex data the transform will be applied to has the form
Fields:
x, y, z - Position of the vertex
color - ALLEGRO_COLOR structure, storing the color of the vertex
u, v - Texture coordinates measured in pixels
If my skybox textures have pixel widths and heights of say w and h, the same for all 6 sides, how should the vertices be created and transforms applied using the API to render it properly?