Description
Description
When drawing 2d objects origin and scaling in y-dimension behaves differently depending on the renderer used.
Expected Behaviour
An object drawn at (0,0) should always be drawn at the top left corner of the window. An object drawn at (width, height) should always be drawn at the bottom right corner.
Current Behaviour
Using the default or the FX2D renderer the behaviour is correct.
Using the P2D or the P3D renderer objects drawn at (0,0) are drawn outside the window above the top left corner. An object drawn at (width, height) is drawn a little under the bottom right corner. So both the origin and the scale are incorrect. I don't expect this behaviour to be pixel perfect, because this isn't possible with OpenGL renderers. But the offset is about 30 pixels, which is a lot.
Steps to Reproduce
void settings() {
size(400, 300, P3D);
}
void draw(){
rect(0, 0, 50, 50);
rect(width-100, 50, 50, 50);
rect(width-50, height-50, 50, 50);
rect(50, height-100, 50, 50);
}
My Environment
Processing version: 3.3.6
Operating system: Windows 10 Pro (Version 1703, build 15063.786)
Possible Causes / Solutions
Translating and scaling provides a workaround:
translate(0, 29);
scale(1, height/(height+33.0));
Translation and scaling values are from observations.