From ecf662adcedcb08b0d934894567b051a7c0a149d Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 10 Dec 2000 23:31:45 +0000
Subject: [PATCH] Corrected handling of Clip Planes

---
 Graphics/Draw.cpp | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index e65c1db060..8432108b81 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-/* $Id: Draw.cpp,v 1.10 2000-12-10 00:06:50 geuzaine Exp $ */
+/* $Id: Draw.cpp,v 1.11 2000-12-10 23:31:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -26,6 +26,8 @@ extern List_T      *Post_ViewList;
 /* ------------------------------------------------------------------------ */
 
 void Draw3d(void){
+  int i;
+
   if(CTX.alpha){
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     glEnable(GL_BLEND);
@@ -37,12 +39,8 @@ void Draw3d(void){
   }
   glPolygonOffset(1.0, 1);
 
-  if(CTX.clip[0]) glEnable(GL_CLIP_PLANE0);
-  if(CTX.clip[1]) glEnable(GL_CLIP_PLANE1);
-  if(CTX.clip[2]) glEnable(GL_CLIP_PLANE2);
-  if(CTX.clip[3]) glEnable(GL_CLIP_PLANE3);
-  if(CTX.clip[4]) glEnable(GL_CLIP_PLANE4);
-  if(CTX.clip[5]) glEnable(GL_CLIP_PLANE5);
+  for(i = 0 ; i < 6 ; i++)
+    if(CTX.clip[i]) glEnable((GLenum)(GL_CLIP_PLANE0 + i));
 
   /* This is sufficient, since we NEVER give different normals to nodes of one polygon */
   glShadeModel(GL_FLAT);   //glShadeModel(GL_SMOOTH);
@@ -57,17 +55,15 @@ void Draw3d(void){
 }
 
 void Draw2d(void){
-  glEnable(GL_CLIP_PLANE0);
-  glEnable(GL_CLIP_PLANE1);
-  glEnable(GL_CLIP_PLANE2);
-  glEnable(GL_CLIP_PLANE3);
-  glEnable(GL_CLIP_PLANE4);
-  glEnable(GL_CLIP_PLANE5);
+  int i;
 
   glDisable(GL_DEPTH_TEST);
   glDisable(GL_LIGHTING);
   glShadeModel(GL_FLAT);
 
+  for(i = 0 ; i < 6 ; i++)
+    glDisable((GLenum)(GL_CLIP_PLANE0 + i));
+
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   /* to draw directly in screen coords */
-- 
GitLab