Perspective + ortho

Hey guys, I'm developing something using pure GL here.

How to use perspective + ortho?



I'm wondering if my thought is correct, please, see:



    - change to projection matrix mode

    - push the projection matrix onto the stack

    - reset the projection matrix

    - set ortho parameters

    - change to modelview matrix mode

    - push the modelview matrix onto the stack

    - reset the modelview matrix

    - set the raster position

    - render the things

    - change to projection matrix mode

    - pop the projection matrix from the stack

    - change to modelview matrix mode

    - pop the modelview matrix from the stack



      ...
      glMatrixMode(GL_PROJECTION);
      glPushMatrix();
      glLoadIdentity();
      gluOrtho2D(0f, 1024, 0f, 768);

      glMatrixMode(GL_MODELVIEW);
      glPushMatrix();
      glLoadIdentity();
      
      glRasterPos3f(10f, 10f, 1f);
      glutBitmapString(BITMAP_TIMES_ROMAN_24, "testing");
                ...

      glMatrixMode(GL_PROJECTION);
      glPopMatrix();

      glMatrixMode(GL_MODELVIEW);
      glPopMatrix();
      ...

Works fine! The camera doesn't affect the ortho mode :slight_smile:



PS: removed the code from here, cause I've found it on com.jme.renderer.Renderer – see setOrtho() and unsetOrtho()