Page 1 of 1

how the CEGUI determine the projection matrix

Posted: Tue Apr 10, 2012 06:24
by zydgyy

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;
}

Re: how the CEGUI determine the projection matrix

Posted: Tue Apr 10, 2012 08:51
by Kulik
Sorry, but this is it, my patience is over. I have banned you.