So I got a simple viewing system where I can change pitch and yaw. I store these as euler angles xrot and yrot and apply them using glRotate. Now I want to add roll.
First I thought I'll just add a third rotation variable(zrot) and that works good if I only have simple keyboard input. But with mouse input it gets trickier. If roll=0, mouse y movement effects pitch and x movement effects yaw. But when roll!=0 this doesn't work.
So then I thought I'll just define the viewing through dir/up/right vectors and rotate around them. This almost works. The problem is that by storing the vectors as floats and continuisly updating them the coordinate system gets misaligned. I read some recommendations about resetting the coordinate system byt recalculating the right/up vectors by using a predefined up vector like (0,1,0). This doesn't work great either since my original up vector might not always be 'up'. There must be an easier way.
Any help or recommendations greatly appreciated. If at all possible I like to keep using euler angles/math.