View Full Version : gl_ClipVertex
01-07-2007, 05:36 PM
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?
01-07-2007, 11:07 PM
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;
#endifNVIDIA 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.
01-08-2007, 07:55 AM
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.