PDA

View Full Version : Hide Part of an Object?



Rong Yao
04-23-2002, 05:41 AM
Is there any way to hide part of an Object, for example, a cylinder?

DFrey
04-23-2002, 05:46 AM
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).]

AdrianD
04-23-2002, 05:50 AM
z-buffer ?

Rong Yao
04-23-2002, 05:56 AM
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.

knackered
04-23-2002, 06:12 AM
Look up "glClipPlane" on the internet, or in the red book.

Coconut
04-23-2002, 06:16 AM
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 (http://www.opengl.org/developers/documentation/Specs/glspec1.1/node28.html#SECTION005110000000000000000)

Rong Yao
04-23-2002, 10:27 AM
If I use clip plane, will all the objects on one side of the plane be invisible?

Coconut
04-23-2002, 10:43 AM
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.

ding
04-23-2002, 03:28 PM
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

ding
04-23-2002, 03:39 PM
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

billy
04-23-2002, 11:27 PM
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.

kon
04-23-2002, 11:46 PM
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

lucidmm
04-24-2002, 03:40 AM
Write a PartialCylinder function.