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 4 of 4

Thread: 4D clipping

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    13

    4D clipping

    I'm having problems implementing 4D clipping. I was just wondering if anyone knew of any websites that could help me. I'm using the c language.

    If not could someone tell me if all vertices of an object are between -1 and 1 in world co-ords and at no time does that object move would this mean that none of its triangles would need clipping???

    My brains completely fried i can no longer think straight grr.

    thanks for any help

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: 4D clipping

    Have a look at section 2.11 of the OpenGL 1.5 specification, it explains coordinate transformations.

    First a modelmatrix is applied to the world coordinates , resulting in eye coordinates.
    Next, the projection matrix applied to the eye coordinates resulting in the clip space coordinates .
    Next a homogeneous normalization is performed resulting in normalized device coordinates.

    These normalized device coordinates must be in the range [-1.0,1.0] to lie inside the clipping volume as you can deduct from the beginning of section 2.12 of the specification.

    N.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    13

    Re: 4D clipping

    I understand the transformation pipeline, but it must be going wrong along the way.

    After my perspective transformation i end up with a lot of negative w values, which i think is causing the problem. Would negative w values cause problems when 4d clipping?? or will my clipping function be to blame??

    Im so far only clipping against the RHS of the frustrum until i know what the problem is.

    thanks for any help that can be given.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: 4D clipping

    As you can see from http://msdn.microsoft.com/library/de...unc02_0oj1.asp

    The w coordinate is taken as the negative of the eye space z-coordinate. Because the x-axis is pointed to the right and the y-axis up, the z-axis is negative in the viewvolume. So visible vertices should have negative z-values in the viewvolume, resulting in positive w coordinates after perspective transformation.

    Maybe you're also implicitly performing a rotation in your projection matrix.

    And make sure you load the identity matrix before calling glfrustum.

    N.

Posting Permissions

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