PDA

View Full Version : Selection problems 2



AleksX
07-17-2002, 07:06 AM
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?

V-man
07-17-2002, 12:35 PM
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

AleksX
07-18-2002, 05:13 AM
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 ??

bpeers
07-18-2002, 05:18 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif
- are you sure the mode is GL_SELECT

just some dumb ideas.. :\

AleksX
07-18-2002, 05:22 AM
yes I'm sure. Thanks for answer

knackered
07-18-2002, 07:17 AM
Good luck in Big Brother, anyway.

V-man
07-18-2002, 06:35 PM
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