Closed felixjones closed 7 years ago
I flipped the entire renderer manually by setting up an upside-down projection, because I prefer higher Y coordinates meaning lower positions on the screen; not to mention that this is how RGSS works.
That said, it starts to get muddy when I'm having to render that to textures, which are then rendered to other textures, before getting to the screen. I'd bet the issue is in one of the framebuffer projections being set up as flipped and then being flipped again by the main projection. Sorry about that.
Here's the Graphics::snap_to_bitmap method I made that shows this problem;
public static Bitmap snap_to_bitmap()
{
Bitmap bmp = new Bitmap(Math.Max(1, width), Math.Max(1, height));
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
GL.ReadBuffer(ReadBufferMode.Front);
GL.Enable(EnableCap.Texture2D);
GL.BindTexture(TextureTarget.Texture2D, bmp.txid);
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, bmp.width(), bmp.height());
GL.BindTexture(TextureTarget.Texture2D, 0);
GL.Disable(EnableCap.Texture2D);
GL.ReadBuffer(ReadBufferMode.None);
return bmp;
}
Any bitmaps with that method will show the true orientation of the frame buffer in GPU memory.
I started implementing snap_to_bitmap and the first thing I noticed was when downloading the frame-buffer it was actually upside-down.
I flipped all the view port textures to investigate and everything was upside-down, including the downloaded frame-buffer, which indicates that the entire program is upside-down.
All texture co-ordinates and Y co-ordinates need to be flipped.
Current state;![current_flip](https://cloud.githubusercontent.com/assets/1824671/8973873/98d046a8-3662-11e5-8ba4-315e01783384.png)
Corrected state (This is correct OpenGL rendering);![all_flipped](https://cloud.githubusercontent.com/assets/1824671/8973876/a2a7271e-3662-11e5-947e-8f47a38eb270.png)
Notice how the world is upside-down in both.