Jump to content
  • Advertisement
Sign in to follow this  
meteorstorm42

OpenGL Need help with OpenGL clip plane equation...

This topic is 2998 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to use glClipPlane( GL_CLIP_PLANE0, clipPlaneEquation ) to create a clip plane that cuts off anything above y = -0.95 (to cut off reflected geometry)

But I can't find enough info on this clip plane equation... just that it's a vector of 4 doubles.

I guessed that the first 3 were the normal, and the last was a translation along the normal, but neither [0, -1, 0, 0.95] nor [0, -1, 0, -0.95] worked.
Erm.... help?

Share this post


Link to post
Share on other sites
Advertisement
The first three parameters define the normal of the plane. I usually leave the fourth parameter as 0.

Try these two exercises to see if it makes a difference:

Exercise 1:
- Set the clip plane equation to <0, 1, 0, 0>. Enable the clip plane.
- Draw a sphere using gluSphere or gluSolidSphere, radius = 1.

Exercise 2:
- glPushMatrix();
- glTranslate(0, 0.5, 0)
- Set the clip plane equation to <0, 1, 0, 0>. Enable the clip plane.
- glPopMatrix();
- Draw a sphere using gluSphere or gluSolidSphere, radius = 1.

If I'm not mistaken, the first exercise should clip off the top half of the sphere, and the second exercise should clip off the top 1/4th of the sphere.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!