I had this seemingly inane threading bug:
this was a multithreading bug that appeared when the cubemap object got destroyed (early) by another thread.
by the time this thread entered the if statement, the cubeMap variable was gone (set to 0 by another thread in the same object)
If you have 3 vectors, right, up, and forward, you can write a ROW MAJOR change of basis matrix as follows:
[ right.x right.y right.z ]
[ up.x up.y up.z ]
[ -forward.x -forward.y -forward.z ]
The new basis in terms of the original basis are the ROWS of this change-of-basis matrix.
This matrix takes any vector with (1,0,0), (0,1,0), (0,0,1) as its OLD basis vectors, and rotates it so that its new basis vectors ARE right,up,forward as given.
A viewing matrix is the transpose of the change of basis matrix, because a viewing matrix “pushes the world away” from a stationary camera. (The viewing matrix isn’t going to _move the camera_, instead it moves the whole world so that the portion you want to see sits in the canonical viewing volume).
To make this column major
Just transpose it.