Multiple viewports

Started by
4 comments, last by LordSputnik 15 years, 9 months ago
Hi! I'm using two viewports an orthographic view, the size of the whole screen, and a perspective view which is a smaller size. My problem is this: When I try to draw a quad in the orthographic viewport onto the portion of the screen that also uses the perspective viewport, it doesn't show up. I don't understand this, as I'm allowing the ortho one access to the whole screen, and rendering into it after the perspective one, so shouldn't any quads be drawn over the top? Many Thanks, Sputty.
Advertisement
most likely the stuff is failing the depthtest
solution - clear the depth buffer before each of the viewport views
Changing the viewport doesn't clear the depthbuffer. If you draw a quad using another projection matrix the depth test might fail, like zedz indicated.

It should work if you either clear the depth buffer, disable depth testing for the quads or depth writes for the smaller viewport, set the appropiate coordinates to 0 for the quad (resulting in depth 0). What is appropriate depends on your needs.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Hmm... I didn't enable depth testing at the beginning... It can't be the cause, can it?
Show us some code then. How do you initialize the context? Your drawing function?
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
... Guess what? It turns out I was giving the orthographic one the wrong co-ordinates... :P Thanks for your suggestions anyway :S

This topic is closed to new replies.

Advertisement