Hide Part of an Object?

Is there any way to hide part of an Object, for example, a cylinder?

In general, yes. More details would help though.

I get the feeling this post should be in the beginner’s forum too.

[This message has been edited by DFrey (edited 04-23-2002).]

z-buffer ?

Sometimes, I do not want to display the whole object, so I hope I can hide part of it. For example, I draw a cyclinder by using gluCylinder Function, I want to hide the right half of this object. I feel that I get no control over the pixels of this object. That’s why I made the post. Perhaps I should post it in Beginners’ Forum, but I just want a quick answer. Thanks.

Look up “glClipPlane” on the internet, or in the red book.

You do have some controls on the pixels using buffers.
Anyway, for your “specific” example, you can use the additional clip planes available in OpenGL. For example, you can look at:
http://www.opengl.org/developers/documen…000000000000000

If I use clip plane, will all the objects on one side of the plane be invisible?

Originally posted by Rong Yao:
If I use clip plane, will all the objects on one side of the plane be invisible?

Only between glEnable(GL_CLIP_PLANEn)
glDisable(GL_CLIP_PLANEn) are clipped.

there is another question like this. If using clipping to hide the part of a object, the plane cut will be only drawed a frame based on the object. How can I capture the pixels in the plane cut in order to fill the plane?

Thanks

ding

In addtion, if I want to hide the part of a object,which is irregular and cannot just put on side of a plane. Who can tell me how to do?

thanks again!

ding

You can use your own function do draw the objects. Then assign a boolean to each polygon to store it’s state hidden or visible. After just render the visible ones.

Try it with GL_ALPHA_TEST! Define your irregular shape in the alpha component of a texture (255 show, 0 hide) and set the alphafunc to pass if value is greater than 0.
Use some TexGen functions to automatically create texcoords.

kon

Write a PartialCylinder function.