Is there any information on this or a simple example? It seemed to me that this function was quite interesting, but difficulties arose in its implementation.

    1 answer 1

    gl_ClipDistance is not a function, but one of the input'a or output'a vertex or geometry shader.

    If this parameter is specified in the corresponding shader, then it is possible to clipping arbitrary vertices based on the distance to the corresponding planes.

    An example of using a geometric shader can be found here.


    In this aspect, the phrase about the difficulties with its implementation is not very clear, although I can certainly assume that you are engaged in some type of task, for example, porting the GLSL compiler to mobile devices.

    In this case, it makes sense to look, for example, at the Mesa3d library and see how the corresponding things are implemented there, opensource.

    • I am not going to use geometric shaders, but I think your example will be useful. - OpenGLprogrammer
    • 2
      > In this aspect, the phrase about the difficulties with its implementation is not very clear, although I can certainly assume that you are engaged in some type of task, for example, porting the GLSL compiler to mobile devices. Then he would know that this is not a function. Just not the correct question. > I'm not going to use geometric shaders, but I think your example will come in handy. Hardly. Without geometric shaders vertices can not be cut off. - gammaker