If you want a gradient background on the window that doesn’t move you should ensure the modelview is identity (or whatever xform you want to position the background relative to the eye) and that the projection matrix is appropriate perhaps even ortho to keep it simple although a gradient quad is easy to set up for any case you care to design.

Basically you need to draw the gradient while you’re in eye space at a minimum. This just means putting that draw call in the right place and ensuring you position it correctly, don’t expect to be ale to draw it any time unless you meet/restore these matrix requirements.

It is appropriate to modify ondraw to initialize these matrices with identity each frame, draw the gradient and then set the matrices to position the eye in the scene for 3D rendering purposes.