I was trying to (ab-)use Löve2D for 3D lately and ran into a weird inconsistency between rendering to a canvas and to the window. Now I'm unsure whether it's a bug or a feature.
When drawing to the window the normal way, the Y-axis get's flipped. This makes sense since Love2D is using the top left corner as origin, but it might be worth of a warning in the wiki that it's a left-hand coordinate system and that it affects culling.
When using a shader that doesn't use the transformation matrix, the Y-axis does not get flipped. I guess this is because the flipping usually takes place in the transform_projection. This might be worth a note on the love.graphics.newShader page, since it's not obvious that it should be this way. Since "position" is only a function that is called by the hidden part of the shader users might think that the flipping might happen somewhere else.
The weird thing is that, when rendering to a canvas, the flipping apparently does happen somewhere else. And since it also affects culling it must happen during rendering to the canvas and not just while drawing the canvas. It's very surprising and send me down the rabbit hole of questioning the projection matrix I was using when I stumbled into this. Because of the culling problem I first thought that Z got flipped or something like that before I figured out that flipping Y fixes it.
So is this a feature or a bug? Where does the Y-axis get flipped? Would it be OK to add the suggested warnings/notes to the wiki?
Attached is a minimal-ish example and a table of observation on it. Unfortunately "flipped" in the table means displayed the none-löve-ish way while in the rest of this post it means the non-opengl-ish way.
Code: Select all
|------|--------|--------|-|---------|--------| | cull | canvas | shader | | flipped | culled | |------|--------|--------|-|---------|--------| | none | o | o | | o | o | | none | o | X | | X | o | | none | X | o | | o | o | | none | X | X | | o | o | | back | o | o | | - | X | | back | o | X | | X | o | | back | X | o | | - | X | | back | X | X | | - | X | | front| o | o | | o | o | | front| o | X | | - | X | | front| X | o | | o | o | | front| X | X | | o | o | |------|--------|--------|-|---------|--------|