I’m working on a 3D game but also have to render some status in 2D. So first I turn on the 3D:
camera(WIDTH/2, HEIGHT/2 - camAngle*1.3, 950 - camAngle/3, WIDTH/2, HEIGHT/2, 0, 0, 1, 0)
perspective(45, WIDTH/HEIGHT, 0.1, 2000)
Then I render the scene, and finally want to switch back to 2D mode:
camera(WIDTH/2,HEIGHT/2,1,WIDTH/2,HEIGHT/2,0,0,1,0)
ortho()
But it doesnt work, drawing after the ortho does not show anything on the screen. so the matrices must be wrong. Documentation says, that ortho() sets it back to standard. So I have choosen a camera which should work. the distance is not that important in ortho, so I have choosen 1.
Any idea, what I missed? I think I could maybe solve it by reading the matrices at start of draw and set them again in my second render pass, but on the other hand i would like to know whats wrong with my code.