diff options
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_vertex.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_vertex.glsl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_vertex.glsl b/source/blender/gpu/shaders/gpu_shader_vertex.glsl index 159e531eb44..b5d8dcc0f35 100644 --- a/source/blender/gpu/shaders/gpu_shader_vertex.glsl +++ b/source/blender/gpu/shaders/gpu_shader_vertex.glsl @@ -2,6 +2,10 @@ varying vec3 varposition; varying vec3 varnormal; +#ifdef CLIP_WORKAROUND +varying float gl_ClipDistance[6]; +#endif + void main() { vec4 co = gl_ModelViewMatrix * gl_Vertex; @@ -10,9 +14,13 @@ void main() varnormal = normalize(gl_NormalMatrix * gl_Normal); gl_Position = gl_ProjectionMatrix * co; -#ifndef GPU_ATI +#ifdef CLIP_WORKAROUND + int i; + for(i = 0; i < 6; i++) + gl_ClipDistance[i] = dot(co, gl_ClipPlane[i]); +#elif !defined(GPU_ATI) // Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA // graphic cards, while on ATI it can cause a software fallback. - gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; + gl_ClipVertex = co; #endif |