Hi,
I have to draw a cube in a 3D space using a perspective camera,
then a scrolling text using an orthogonal camera. In some case, when the
cube is too close, it intersects scrolling the text, even if I use 2
cameras. So I used a trick: when I set the ortho camera, before I draw the
scrolling text, I call again glClear(GL_DEPTH_BUFFER_BIT). It works very
well. I do
clear color buffer and depth buffer
set camera 1 (perspective)
draw the cube
set camera 2 (ortho)
clear depth buffer
draw the scrolling text
draw other objects (?)
flush
The problem is that now I have not longer my depth buffer, so I can't
properly draw any other 3D object, not even if I re-set the camera 1.
I cannot change the drawing object order because I can't know in advance.
Reading-Writing the z buffer is time consuming, so please have you a good
idea to draw as on different layers?
Best Regards