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: viewed volume

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2002
    Location
    saint cyprien, 66, france
    Posts
    5

    viewed volume

    I would like to know if we can do a matrix that give a frustum volume with a triangular base

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: viewed volume

    Triangular cant be done but you can approximate it with a trapezoidal projection.

    What you need to do is establish a scale matrix to scale one of the coordinates (y in this case), along one of the axis (y axis in this case)

    Something like this should do:

    glLoadIdentity()
    glFrustum(0, value, 0, value, 1.0, far);
    glScalef(1.0, y, 1.0);

    where y is some large positive value.

    V-man



    [This message has been edited by V-man (edited 05-02-2002).]
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

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