Top Left vs Bottom Left Coordinates Origin
  • igierardigierard January 17
    Posts: 3

    I've noticed that that in Pixelwave, like flash and most other 2d graphics applications, the 0,0 origin point is located int he top left and positive y values move down the screen. This seems like a good idea, especially since Pixelwave is trying to emulate that flash APIs. I've also noted that OpenGL's default coordinate system starts in the bottom left with positive y values moving up the screen, this matches the more mathematically traditional approche. 


    I've been looking thew the Pixelwave code base to see how it is doing the coordinates translation but so far I haven't been able to figure it out. Could anyone here point me in the right direction? It would make integrating third party code with Pixelwave easier and vice versa.
  • BekennBekenn January 18
    Posts: 53

    PXGL.m, lines 2280-2285:

       glOrthof(0,                       // xMin
                 pxGLWidthInPoints,     // xMax
                 pxGLHeightInPoints,    // yMin
                 0,                        // yMax
                 -100.0f,              // zMin
                  100.0f);             // zMax

    Note how pxGLHeightInPoints is given for bottom, and 0 is given for top.  This flips the OpenGL coordinate system such that (0, 0) is in the top left.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter Sign In with OpenID

Sign In Apply for Membership

In this Discussion

Top Posters