noodle-learns-programming / monoxna

Automatically exported from code.google.com/p/monoxna
0 stars 0 forks source link

RenderTargets are upside down #78

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a render target, attach it to the GraphicsDevice at 0.
2. Draw something.
3. Detach the same render target (pass null), then draw the texture from the 
render target.

What is the expected output? What do you see instead?
RenderTarget texture should be rendered in the expected orientation, but 
instead the image is flipped along the horizontal axis.

This is just a side effect of OpenGL, where it internally renders things upside 
down. I assume when you draw to the back buffer, OpenGL will automagically take 
care of flipping it when you swap buffers. If we're in some other buffer, it'd 
be our game.

We could flip projection matrices for all drawing calls, but I'm not sure if 
it's a great idea of messing with the user's matrix setup.

We can also set the "null" rendertarget as an FBO that XNA will render into 
internally, then at the end of the drawing cycle, we draw the contents of the 
FBO to a quad. This can also provide an easy implementation of 
ResolveBackBuffer, where we can just copy it over. Unfortunately this will take 
up a rendertarget, and I am unsure how it will fare performance wise.

Any ideas?

Original issue reported on code.google.com by ali.scis...@gmail.com on 15 Dec 2011 at 8:53

GoogleCodeExporter commented 9 years ago

Original comment by ali.scis...@gmail.com on 15 Dec 2011 at 8:54