selection

hi,

if i create an object as follow:

glNewList(300, GL_COMPILE);
glBegin(GL_QUADS);
glVertex3d(0.0, 0.0, 0.0);
glVertex3d(50.0, 0.0, 0.0);
glVertex3d(50.0, 0.0,50.0);
glVertex3d(0.0, 0.0,50.0);
glEnd();
glEndList();

in order to pick it by mouse, is the following code right:;

glLoadName(0)
glCallList(300);

my pb is that the hit returned is 0, when i invoke glRenderMode(GL_RENDER)

but if i replace my object by glutSolidCube(50), now it works !!!

WHY?

another question:

is the selection depending on the texture mapped to the object?
is the selection depending to the location of the camera with gluLookAt, by using the projection transform?

thx!

If you call glLoadName 0 and it returns 0, then I think it is running ok.

no it’s wrong because if it returns , that means no object has been selected!!

>my pb is that the hit returned is 0, when i invoke glRenderMode(GL_RENDER)
> but if i replace my object by glutSolidCube(50), now it works !!!

My guess is that your object isn’t effectively drawn under the mouse in selection mode, but your cube, with luck, gets under it.
2 possibilities :
either you haven’t rewriten the exact camera code (gluperspective etc…) as when rendering and your object isn’t at the same place (object is drawn shifted in selection mode)
or you are not giving the good mouse coordinates (for some obscure reason), and the gluPickMatrix() function doesn’t pick at the place you expect it to pick.
I personally met both of these problems !!
A good way to find this out is to control the mouse x and y values, and to draw the selection as a render (commenting //glRenderMode(GL_RENDER) and //gluPickMatrix() ) so you can view exactly how your selection is drawn.
Hope this will help !
Alban