I’m reading on how to simulate water, but unfortunately stuck trying to find an alternative for gl_ClipPlane. I’m using WebGL 1 and it uses GLSL 1.0. Is there anyway I can do the same thing (gl_ClipPlane) does within the vertex shader (or frag shader)?
In desktop OpenGL, user-defined clip planes are implemented as a fixed-function process. The vertex shader simply sets the interpolation parameter which this requires. You could do it with a geometry shader, but ES doesn’t have those either.
…but having trouble trying to understand how I can discard a pixel.[/QUOTE]
With a “discard” statement in the fragment shader, as shown in that example.
Note that you can move the dot products into the vertex shader, setting user-defined outputs which are the equivalent of gl_ClipDistance. Then you just need to discard any fragment for which the clip distance is negative.
[QUOTE=GClements;1287320]In desktop OpenGL, user-defined clip planes are implemented as a fixed-function process. The vertex shader simply sets the interpolation parameter which this requires. You could do it with a geometry shader, but ES doesn’t have those either.
With a “discard” statement in the fragment shader, as shown in that example.
Note that you can move the dot products into the vertex shader, setting user-defined outputs which are the equivalent of gl_ClipDistance. Then you just need to discard any fragment for which the clip distance is negative.[/QUOTE]
Gc thanks a lot, with this I have enough info to keep going. By the way I honestly didn’t know that discard was actually a real statement, thought it was pseudo code. :doh: I got the hang of opengl implementation, but now I’m learning glsl.