Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: GLM::ORTHO reverts Y-axis. Why?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Feb 2018
    Posts
    5

    Question GLM::ORTHO reverts Y-axis. Why?

    I'm using GLM library. And when I initialize orthographic perspective the Y-axis gets reverted, the positive becomes down. How do I revert it so that the positive is up but still use glm:rtho? Thanks.
    Code :
    glm::mat4 projection_mat = glm::ortho((float)leop_opengl_window.getWidth()*-1.0f, (float)leop_opengl_window.getWidth(), (float)leop_opengl_window.getHeight(), (float)leop_opengl_window.getHeight()*-1.0f);

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,398
    Swap your bottom and top arguments.

    In OpenGL, the Y axis points up (in eye space and NDC space). So your bottom should be less than your top, unless you intentionally want to flip the orientation vertically.

    See:


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •