Closed theraot closed 3 years ago
This is correct, viewports are flipped by default (due to OpenGL coords). ViewportContainer will automatically flip the texture for you, but when you e.g. add ViewportTexture to a Sprite, it will be upside-down too.
@KoBeWi Does that means that ViewportContainer flips the texture when it should not? Because, I'd suppose that is the bug then.
This is probably intended behavior. ViewportContainer is supposed to display a Viewport for you in 2D, and since the viewport renders upside-down (due to 2D view having opposite vertical axis to the OpenGL's one), it automatically flips it for you so you can see it correctly. Maybe we should document this at least.
@KoBeWi It make sense that you would want ViewportContainer to show the Viewport texture the way it does by default.
Let us imagine if ViewportContainer didn't flip. People would have found it didn't behave as expected, gone online, perhaps asked for help, and otherwise stumble onto the solution of using V Flip. It makes sense to ease that usability.
However, I would have argued for making V Flip true by default instead of a hidden flip on ViewportContainer. Which also gets you the result of the Viewport showing as expected on the ViewportContainer by default (with less hidden things, and thus with less astonishment down the line, e.g. when using the Viewport texture).
I wonder if people using the Viewport texture are setting V Flip to true more often than not. If they are, that would also support the idea that making it true by default is a good idea. I believe there is no data on that.
Anyway, I suppose that is proposal territory. And a proposal hard to justify (ViewportContainer looks as expected by default, and we have V Flip), so I'll not be writing it.
This issue should be marked as won't fix, right?
This is actually fixed in 4.0. I can't really test with viewport previews, because they seem broken, but I tried a QuadMesh with ViewportTexture and it's upside-down in 3.x, but displays correctly in 4.0.
Godot version
3.4.beta2, 3.4.beta3
System information
Windows 10, GLES2/GLES3, Nvidia GeForce GTX 750 Ti
Issue description
The Viewport Preview in the Inspector Panel appears upside down. This is an IDE UI issue. This happens in both GLES2 and GLES3.
While the Viewport Preview being upside down, the Viewport shows correctly in game:
It also shows correctly in the 2D view:
V Flip will flip both the Viewport and the Viewport Preview:
To reiterate V Flip is not the issue. I repeat: V Flip is NOT the issue.
Steps to reproduce
Minimal reproduction project
No response