[vtkusers] RE:Trying using glClipPlane in VTK

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


Hello again,

Never mind!! I got it working. I needed to get the view transformation matrix
from the camera to transform the plane eqaution first before passing it on the
Ogl.

-Jerome




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