Why does FBO clip above ortho 0,0?


I have a question about the way the FBO clips the visible scene.

I’m using glOrtho for 2D and using render-to-texture with FBO. Since the FBO is upside-down and reversed, I draw all content that way so the generated texture isn’t.

Therefore the “bottom right” of my FBO is 0,0.

I find that when any part of the scene passes the negative side of 0,0 that it appears clipped from the FBO generated texture.

Why does it do that? Is it because of the viewport setting?



First of all, FBO is not upside down. It shares the same coordinate system as rendering to normal desktop window.

Your viewport should be set to cover the resolution of FBO render target (renderbuffer or texture). Like (0,0,w,h)

glOrtho sets the range of coordinates in your scene that will be visible. So you can play with this. You can flip coordinate system, you can use negative numbers, … whatever you want.

Thanks for your help.

In my experience, I mean I’m not an expert here, but if you render your 2D scene into an FBO (or perform a glSubTex on the screen buffer) unless you flip your glOrtho, the texture output is upside down.

I have unflipped everything in my FBO section and used the glOrtho like I should have to flip the view before it’s committed to texture.

I have adjusted the glOrtho and tried adjusting the viewport and ortho for the FBO section, but I am still getting this clipping of content.

I have a 1024x768 window and the FBO is 1024x1024 and the bottom of it is increasingly clipped as I translate textured quads within the view.

Does glFrustum clip the FBO?