PDA

View Full Version : Picking problem on Shadow?



SiuBanana
04-21-2000, 08:36 AM
Hi all,
I got a problem on picking on a shadow. In detail, I have created some objects with their shadows and I can make a correct selection hit when clicking on those objects. However, when I click on those shadows, it also makes a selelction hit which I don't expect. Since it makes me to pick that object even when I click on its shadow.
How to get rid of this problem? or what's wrong with my code. Hope u can understand and help!

void display(void) {
....
glPushMatrix();
for (pos = myObjects; pos; pos = pos->next)
{
i++;
glPushMatrix();
if (mode == GL_SELECT)
glLoadName(i);
pos->name = i;
glTranslate.....
glRotate.....
glCallList(pos->number);
glPopMatrix();

// draw shadow
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_LIGHTING);
glColor4f(0.0f, 0.0f, 0.0f, 0.3f);

glPushMatrix();
glMultMatrixf((GLfloat *) floorshadow);
glTranslate.....
glRotate.....
glCallList(pos->number);
glPopMatrix();

glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
} // end for loop
glPopMatrix();
} // end display

FATBUDDHA
04-21-2000, 12:32 PM
Draw your shadows with just (say) "0" on the name stack, and then ignore any objects called "0" while processing your hit records.

Hope this helps.