logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

gl_CullDistance - provides a mechanism for controlling user culling

Declaration

gl_CullDistance is a member of the gl_PerVertex named block:

           out gl_PerVertex {
               vec4 gl_Position;
               float gl_PointSize;
               float gl_ClipDistance[];
               float gl_CullDistance[];
           };

       In fragment shaders, it is intrinsically declared as: in float gl_CullDistance[] ;

Description

       The gl_CullDistance variable provides a mechanism for controlling user culling. The element
       gl_CullDistance[i] specifies a cull distance for each plane i. A distance of 0.0 means that the vertex is
       on the plane, a positive distance means that the vertex is insider the cull volume, and a negative
       distance means that the point is outside the cull volume. Primitives whose vertices all have a negative
       clip distance for plane i will be discarded.

       The gl_CullDistance array is predeclared as unsized and must be sized by the shader either by redeclaring
       it with an size or by indexing it only with integral constant expressions. The size determines the number
       and set of enabled cull distances and can be at most gl_MaxCullDistances. The number of varying
       components consumed by gl_CullDistance will match the size of the array. Shaders writing gl_CullDistance
       must write all enabled distances, or culling results are undefined.

       As an output variable, gl_CullDistance provides the place for the shader to write these distances. As an
       input in all but the fragment language, it reads the values written in the previous shader stage. In the
       fragment language, the gl_CullDistance array contains linearly interpolated values for the vertex values
       written by a shader to the gl_CullDistance vertex output variable.

       It is a compile-time or link-time error for the set of shaders forming a program to have the sum of the
       sizes of the gl_ClipDistance and gl_CullDistance arrays to be larger than
       gl_MaxCombinedClipAndCullDistances.

Name

       gl_CullDistance - provides a mechanism for controlling user culling

See Also

gl_ClipDistance(), gl_PointSize()

Version Support

       ┌─────────────────┬───────────────────────────────────────────────────────────────────────────────────┐
       │                 │        OpenGLShadingLanguageVersion                                            │
       ├─────────────────┼──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┤
       │ Variable1.101.201.301.401.503.304.004.104.204.304.404.50 │
       │ Name            │      │      │      │      │      │      │      │      │      │      │      │      │
       ├─────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ gl_CullDistance │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  ✔   │
       └─────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘

See Also