PDA

View Full Version : enable,diable clipping planes



kellerassel
05-19-2000, 03:00 AM
Is there a way to use clipping planes
only for some objects in your 3D model?

I tried glEnable and glDisable on an additional clipping plane when I draw one of my objects, it did nt work!

Are there any ways to do this?

Bob
05-19-2000, 03:45 AM
You enable and disable additional clippingplanes with glEnable/glDisable(GL_CLIP_PLANEi), where i is the clippping plane you want to enable/disable. I can't see any problems with just disabling one clippingplane before you draw an object. Post some code and see if we can find some problems...

kellerassel
05-19-2000, 04:56 AM
Hmm...
That's not so easy since this code is
part of a C++ OpenGL wrapper class.
But you think this code should work:
>---------------------

GLdouble eqc[4] = {0.0, 0.0, -1.0, 0.0};

glNewList( list, GL_COMPILE );

glClipPlane( GL_CLIP_PLANE0, eqc );
glEnable( GL_CLIP_PLANE0 );

makeObject1();

glDisable( GL_CLIP_PLANE0 );

makeObject2();

glEndList();

---------------------------<

If I want to clip Object2 only?!

Keller...


Originally posted by Bob:
You enable and disable additional clippingplanes with glEnable/glDisable(GL_CLIP_PLANEi), where i is the clippping plane you want to enable/disable. I can't see any problems with just disabling one clippingplane before you draw an object. Post some code and see if we can find some problems...

kellerassel
05-19-2000, 04:59 AM
Sorry, .... clip Object1 .....

Bob
05-19-2000, 07:17 AM
Hmm, got one question to you.

Your code is calling makeObject*(). Does this function build an object (say to a displaylist or so) and then you call something like drawObject*() when you wanna draw it, or is makeObject*() actually drawing the object?

Clippingplanes have no effect when building a displaylist. So if you enable a clippingplane when building, it will still build the whole object.

vallabh24
03-28-2004, 01:37 AM
How do u get the object to be clipped then?

I mean i have defined a clipping plane and then use a Display list... Will the clipping plane be ignored when object is displayed?

03-28-2004, 03:53 AM
No, only when building a display list. When executing a display list the clipping planes should be properly processed.