0

Suppose I would like to draw the following lines:

   const GLfloat lineX[] = {
        FrustumData.left * FrustumData.ratio , (FrustumData.top + FrustumData.bottom) / 2 * FrustumData.ratio, FrustumData.zFar, //point A
        FrustumData.right * FrustumData.ratio , (FrustumData.top + FrustumData.bottom) / 2 * FrustumData.ratio, FrustumData.zFar //point B
    };
    const GLfloat lineY[] = {
        (FrustumData.left + FrustumData.right) / 2 * FrustumData.ratio , FrustumData.bottom * FrustumData.ratio, FrustumData.zFar, //point A
        (FrustumData.left + FrustumData.right) / 2 * FrustumData.ratio , FrustumData.top * FrustumData.ratio, FrustumData.zFar //point B
    };
    const GLfloat lineZ[] = {
        (FrustumData.left + FrustumData.right) / 2 * FrustumData.ratio, (FrustumData.top + FrustumData.bottom) / 2 * FrustumData.ratio, FrustumData.zFar, //point A
        (FrustumData.left + FrustumData.right) / 2 , (FrustumData.top + FrustumData.bottom) / 2 , FrustumData.zNear //point B
    };

where ratio = zFar/zNear and everything else is glFrustum parameters.

Shouldn't I see the lines for any selection of Frustum parameters or it depends somehow on glViewport?

because I don't see them right now and I can't understand why.

Thank you.

Alex Fish
  • 768
  • 6
  • 18

1 Answers1

1

There's no direct connection between the two. But they both have a direct influence on where things will appear on the screen.

Essentially glFrustum is a function to create a projection transformation of a certain kind, namely one, that creates perspective. I recommend reading another answer written by me, which explains the transformation stages of OpenGL.

In that answer I wrote:

This transformation maps some volume in eye space to a specific volume with certain boundaries, to which the geometry is clipped.

glFrustum is defining such a volume. It looks like a pyramid with its tip cut of (a frustum), where the tip would be at the eye space origin, the "cut" was the near clip plane and the pyramid's base the far clip plane. The parameters left, right, bottom and top define the extents of the near clipping plane in eye space units.

Community
  • 1
  • 1
datenwolf
  • 159,371
  • 13
  • 185
  • 298