picking + pusmatrix

I want to perform picking on some objects that have their own local coördinate system.
To draw those local objects, i push & pop a transformation-matrix and draw the objects as if they were in the origin.

My problem:
if i use the same transformations in glRenderMode(GL_SELECT); to build a selection buffer the selection does not work. Is this because those transformations are not supported in GL_SELECT? Does anyone know this problem and what can i do about it?

p.s.: The selection works ok with absolute coordinates, so without using the local coordinatesystem.

tnx in advance

[This message has been edited by JeeTriX (edited 05-21-2002).]

They should work. You can debug by rendering the area you cliked on. Are you using gluPickMatrix? If so, then maybe the problem lies there.

It went something like

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPickMatrix(…); <-- what’s in here?
glFrustum or glOrtho

V-man

I know they should work because if they don’t, they would be pointless. But i had already a decent amount of problems with selection due to the lack of openGL support on the matrox i’ve been testing on, so i would not be astonished if this was a known problem…

Anyway, i’ll paste some of the code to make sure all my calls are right:

glGetIntegerv(GL_VIEWPORT, viewport);
glSelectBuffer(256,selectBuf);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(x,(viewport[3]-y),15.0,10.0,viewport);
gluPerspective(45.0,ww/wh,1.0,250.0);


glPushMatrix();
glLoadName(cadTmp->GetID());
glTranslatef(ori.GetX(),ori.GetY(),ori.GetZ());
glRotatef(cadTmp->GetCoordinateSystem()->GetRotationZ(),0.0,0.0,1.0);
glRotatef(cadTmp->GetCoordinateSystem()->GetRotationX(),1.0,0.0,0.0);
glRotatef(cadTmp->GetCoordinateSystem()->GetRotationY(),0.0,1.0,0.0);

…(here i draw)…

glPopMatrix();

glPopMatrix();
glFlush();
GLint hits = glRenderMode(GL_RENDER);


How can i render the area i clicked on?

[This message has been edited by JeeTriX (edited 05-22-2002).]

If you want to render, just remove the glRenderMode commands you got there, and repaint the scene when you click.

But I dont see a problem with the code. You can try the red book examples to see if they work.

V-man

Whatever it may be that keeps me away from selcting my objects, i’m gonna ignore it & do raytracing i’m on it for 2 days now, i can’t even see what i draw in that selection buffer… i’ll assume the mode is not supported perfectly on my card…

What is your card + driver exactly?

V-man