Up vector in camera()

edited July 2015 in Programming Questions

As said in reference, the default camera setting is

camera(width/2, height/2, (height/2) / tan(PI/6), width/2, height/2, 0, 0, 1, 0);

the y axis is positive downward in Processing, so why the up vector is (0, 1, 0) instead of (0, -1, 0)?

Thank you!

Answers

  • In 2D you are talking about pixel positions and [0,0] is the top left corner with x increasing to the right and y increasing downwards.

    The camera() command controls viewing in 3D and Processing uses OpenGL and OpenGL defines the up direction as [0,1,0]

  • Thank you for your reply! But I haven't get it yet..

    OpenGL's default coordinate system is right handed, with positive Y axis toward upward, and positive Z axis toward 'outside', so how the code I posted tranforms OpenGL's coordinates into Processing's counterpart?

  • edited July 2015

    camera(...) is used in P3D and OPENGL modes (both of these modes use OpenGL)

    Processing (since V2) does not have its own 3D coordinate system so there is no counterpart only OpenGL's coordinate system.

  • edited August 2015

    ... is used in P3D and OPENGL modes (both of these modes use OpenGL).

    Since Processing 2 series, P3D & OPENGL refer to the very same renderer:
    println(P3D == OPENGL); // true

    We can also test whether current renderer is OpenGL based:
    println(isGL());

    P.S.: Old Processing 1's P3D wasn't OpenGL based. Only OPENGL mode was so back then! :P

  • Thank you!

    Processing (since V2) does not have its own 3D coordinate system so there is no counterpart only OpenGL's coordinate system

    so, 3D coordinate system in Processing is right-handed, right? but according to THIS, the system in Processing is left-handed..

    Am I losing anything?

  • Answer ✓

    That was true for Processing before V2. In those days P3D was not based on OpenGL is was a 3D software renderer created for Processing. I think the P3D reference needs updating :)

  • After testing, it makes me even more confused, as the default setting of P3D does make a left-handed system, just like the reference says.

Sign In or Register to comment.