[vtkusers] Trying using glClipPlane in VTK

Hummel, Jerome Jerome.Hummel at fr.michelin.com
Mon Nov 13 04:26:07 EST 2006


Hello all,

I would like to try and improve performances with clipping.
It seems vtk is doing a software clipping so i am trying to test hardware
clipping using OpenGL glClipPlane function.
I am using a PlaneWidget to define the plane equation.
The problem is that the plane does not take into account the current
transformation matrix so the plane does not move with the object when rotating
it or translating it with an interactor. Does anybody know what I should do to
make the plane take account of the current model view projection matrix ?
Here is the code I use when the plane widget receive an end interaction event :
PlaneWidget->GetCenter(center);
PlaneWidget->GetNormal(normalVector);   
delta = normalVector[0] * center[0] + normalVector[1] * center[1] +
normalVector[2] * center[2];
    
GLdouble        planeEquation[4];
planeEquation[0] = normalVector[0];
planeEquation[1] = normalVector[1];
planeEquation[2] = normalVector[2];
planeEquation[3] = -delta;
glClipPlane((GLenum)(GL_CLIP_PLANE0), planeEquation);

if(!glIsEnabled((GLenum)(GL_CLIP_PLANE0)))
  glEnable((GLenum)(GL_CLIP_PLANE0));

thanks in advance
-Jerome



More information about the vtkusers mailing list