View Full Version : moving clipping plane

10-13-2015, 10:48 PM
I am new to opengl. I have written a code for a 3d cube.But now I want it to be cut by a plane, so that I can get a cross sectional view of the cube.More Over,I want to move the plane along a particular axis and simultaneously get the cross section view of the cube on a separate window.I used the glClipPlane() function,and managed to get some of the fore mentioned ideas to work.But I want to make the clipping plane visible so that I Can see the plane and navigate it.

10-14-2015, 08:03 AM
You can set own clip planes in geometry shaders. Just provide your shader with a vec4 component that defines your wanted clip plane. Now you can tell OpenGL to clip at that plane:

gl_ClipDistance[0] = dot(gl_Position, frustumPlane);

Note, gl_Position needs to be viewprojected. frustrumPlane is your vec4 component defining your clip plane.

10-14-2015, 09:45 AM
Post a picture of what you have now. I assume it's side-by-side windows?