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: load matrix after glFrustum

  1. #1
    Newbie Newbie
    Join Date
    Sep 2013
    Posts
    2

    load matrix after glFrustum

    I'm now creating for the first time an Augmented Reality application. I'm using ARToolkit libraries to obtain the transformation matrix.
    In an example this matrix is transformed in a GLformat (3x4 to 1x16 cause the last row is always composed by three zeros and a last one) and the loaded with the function glLoadMatrix in GL_MODELVIEW. Everithing work well..
    Now I have the problem that the object i want to see in my AR application is too far from the origin of coordinate system, the far clipping plane don't let it see..

    I read in the red book that glFrustum can help me, so I write this code, but I don't see anything at all!!
    In my opinion mi mistake is the bad use of GL_PROJECTION adn GL_MODELVIEW..

    Here I post my code.. maybe someone of you know the answer to my question..

    Code :
    	glMatrixMode(GL_PROJECTION);
    	glLoadIdentity();
    	glFrustum (-1, 1, -1, 1, 1.5, 20000.0);
    	glMatrixMode (GL_MODELVIEW);
    	glLoadMatrixd( gl_para );
     
            glutSolidCube(40);

    I tried also this

    Code :
    	glMatrixMode(GL_PROJECTION);
    	glLoadMatrixd( gl_para );
    	glFrustum (-1, 1, -1, 1, 1.5, 20000.0);
    	glMatrixMode (GL_MODELVIEW);
     
            glutSolidCube(40);

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,126
    Quote Originally Posted by jack_aerospace View Post
    Code :
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glFrustum (-1, 1, -1, 1, 1.5, 20000.0);
        glMatrixMode (GL_MODELVIEW);
        glLoadMatrixd( gl_para );
     
        glutSolidCube(40);
    Try commenting out glLoadMatrixd and replacing with glLoadIdentity, to get rid of one unknown.

    With this, the glutSolidCube sends a cube with X,Y,Z in -20..20 down the pipe. Part of it with Z < -1.5 is in-frustum. However, since the eyepoint is inside the cube, most likely it is backface culled. Try glDisable( GL_CULL_FACE ). Now depending on your other GL state you may be able to see it.

    I tried also this

    Code :
        glMatrixMode(GL_PROJECTION);
        glLoadMatrixd( gl_para );
        glFrustum (-1, 1, -1, 1, 1.5, 20000.0);
        glMatrixMode (GL_MODELVIEW);
     
        glutSolidCube(40);
    If gl_para is a MODELING and/or VIEWING transform, it should definitely not be mixed into the PROJECTION matrix stack.

Posting Permissions

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