PDA

View Full Version : Capping in Display Lists?



Clayton
08-01-2003, 07:41 AM
Is it possible to do capping in a display list? I've set it up so that it Draws the object ( a sphere ) fills the stencil buffer, draws the Capping Quadralateral, and clears the stencil buffer all in one draw and call that a whole bunch. If I've called the Clipping plane before I've made the call to draw the objects in a display list should it still cap?
Because It's not, it might be a problem with the actual capping though. Just wanted to make sure that it's possible in the first place.

147-2
08-01-2003, 12:35 PM
I do the entire shadow in a display list, cap and all. The display lists should be able to handle all the stencil value switches and culler switches.

Clayton
08-04-2003, 01:08 PM
It must be the code itself then, it looks right to me however,
void drawSphere( const Point ¢er, const double radius, const QColor &color, int DrawQuality )
{
if(!(glIsEnabled(GL_STENCIL_TEST)))
{
glEnable(GL_STENCIL_TEST);
}
glEnable(GL_LIGHTING);
GLfloat TheColor[4] = { color.red()/255.0, color.green()/255.0, color.blue()/255.0 , 0} ;
glPushMatrix();
static GLUquadricObj* qobj = gluNewQuadric();
glTranslatef( center.x(), center.y(), center.z() );
glColor3f( color.red()/255.0, color.green()/255.0, color.blue()/255.0 );
glStencilFunc(GL_ALWAYS,0x1,~0);
glStencilOp(GL_REPLACE,GL_REPLACE,GL_INVERT);
gluSphere( qobj, radius,DrawQuality, DrawQuality );
glPopMatrix();

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glColor3f( color.red()/255.0, color.green()/255.0, color.blue()/255.0 );
glStencilFunc(GL_EQUAL,0x1,~0);
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
glBegin(GL_QUADS);
glVertex2f(-1.0,-1.0);
glVertex2f(1.0,-1.0);
glVertex2f(1.0,1.0);
glVertex2f(-1.0,1.0);
glEnd();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
See what's going on?