I was wondering since I am clipping my mesh with glClipPlane() I need to use gl_ClipVertex in the vertex shader, do I need two different versions of the same shader? one with and one without the gl_ClipVertex call? Does it cause any problems? Mainly speed issues? Or was this a problem for Vertex/Fragment programs back in the day?


On NVIDIA you have to use gl_ClipVertex in order to use clipping. If you don’t use clipping then you can still have gl_ClipVertex in your shader - it will make no difference.
On ATI you don’t need to write anything to gl_ClipVertex - clipping will work anyway. And using it can get you into trouble since Radeon 9k / Radeon X don’t suport this (not sure about Radeon X1000)
So your best bet is to put something like this in your shader:

  gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;

NVIDIA has __GLSL_CG_DATA_TYPES defined, so your shader will compile with gl_ClipVertex on NVIDIA and without it on ATI.
You can then use such shader, no matter if you have clip planes enabled or not in your application.


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.