# OpenGL clipping plane

I need to move clipping plane of OpenGL and begin the clipping from that position. The default location of clipping plane is (0,0,0), so if my model is far enough from the center of coordinate system it immediately disappears, as I begin the clipping, cause it appears in the half clipped by the plane that just moved from (0,0,0) point. So what I need is :

1. Create a clipping plane
2. Translate it to the point I want (normally it's near model surface I want to clip)
3. Begin the clipping from that point and not from (0,0,0).

How can I achieve my goal ?

• So, did jpaver's suggestion work? – sam hocevar Nov 4 '11 at 22:03

## 1 Answer

glClipPlane takes 4 coordinates for the plane equation: {Nx, Ny, Nz, d}, where N=[Nx,Ny,Nz] is the normal of the plane, and d is the projected distance of any point on that plane along the normal.

The definition of a plane is:

dotProduct(P,N) + d = 0

(where P is any point on that plane)

So, by simple math,

d = -dotProduct(P,N)


eg. if you want to place your plane at (0,3,1), you calculate:

d = -dotProduct([0,3,1], [Nx,Ny,Nz])


then it should just be a matter of sending Nx,Ny,Nz,d to glClipPlane.