Selection problems 2

This code works:

glLoadName(0);
auxSolidCube(30.0f);

glLoadName(1);
auxSolidSphere(2.0f);

glLoadName(2);
auxSolidSphere(4.0f);

and this code does not:

glLoadName(0);
glColor3f(1.0f,0.0f,0.0f);
glBegin(GL_QUADS);
glVertex3f(-90.0f, -125.0f, 0.0f);
glVertex3f( 90.0f, -125.0f, 0.0f);
glVertex3f( 90.0f, 125.0f, 0.0f);
glVertex3f(-90.0f, 125.0f, 0.0f);
glEnd();

glLoadName(1);
glColor3f(0.0f,0.0f,0.0f);
glBegin(GL_QUADS);
glVertex3f(-75.0f, 80.0f, 1.0f);
glVertex3f( 75.0f, 80.0f, 1.0f);
glVertex3f( 75.0f, 110.0f, 1.0f);
glVertex3f(-75.0f, 110.0f, 1.0f);
glEnd();

Why is it so? Does anybody know the answer or know where can i find it?

You are loading a value called name onto the top of the stack and rendering your object.

Why it works? GL uses the name that you are giving it. Another method is with pushname and popname.

The red book probably explains things clearer.

PS: no need to call glColor.

V-man

I don’t know if you understood what is my problem. I can select only objects from Aux library and object drew with glVertex, gluDisk… and other can’t or it doesn’t work the way I want. That’s why I’m looking for help. Do you know what causes this ??

Some silly suggestions

  • are you sure the stack is not empty – Load requires a value, or else use push and pop
  • are you sure the tris are being rendered etc
  • are you sure the mode is GL_SELECT

just some dumb ideas… :\

yes I’m sure. Thanks for answer

Good luck in Big Brother, anyway.

Oh, you say it doesn’t work for the last 2 examples.

I can give possible reasons, like the objects aren’t rendered where you think they should be.

Either that or the aux library has magical powers.

V-man