how the CEGUI determine the projection matrix

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

zydgyy
Just popping in
Just popping in
Posts: 14
Joined: Mon Mar 05, 2012 03:01

how the CEGUI determine the projection matrix

Postby zydgyy » Tue Apr 10, 2012 06:24

Code: Select all

void OpenGLRenderTarget::updateMatrix() const
{
    const double w = d_area.getWidth();
    const double h = d_area.getHeight();
    const double aspect = w / h;
    const double midx = w * 0.5;
    const double midy = h * 0.5;
    d_viewDistance = midx / (aspect * d_yfov_tan);

    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    gluPerspective(30.0, aspect, d_viewDistance * 0.5, d_viewDistance * 2.0);
    // Projection matrix abuse!
    gluLookAt(midx, midy, -d_viewDistance, midx, midy, 1, 0, -1, 0);
    glGetDoublev(GL_PROJECTION_MATRIX, d_matrix);
    glPopMatrix();

    d_matrixValid = true;
}

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: how the CEGUI determine the projection matrix

Postby Kulik » Tue Apr 10, 2012 08:51

Sorry, but this is it, my patience is over. I have banned you.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests