Hylke Donker

07-29-2005, 07:16 AM

Hello,

I would like to use selection for picking.

As I understand, every geometric primitive which is in the viewing volume, causes a hit right?

If you have a couple of triangles, which are only one name, they only cause one hit.

My OpenGL redbook says this about glLoadname:

Replaces the value at the top of the name stack with name.[..]So glLoadName(blaat); would equal to:

glPopName();

glPushName(blaat);But here's the thing I don't understand.

All my code examples of my book look like this:

glLoadName(x);

drawsomething();

glLoadName(x+1);

drawsomething2();

glLoadName(x+2);

drawsomething3();

[..]But doesn't that *delete* the last value in the stack and then add a new one to it?

So if I understand it right, it would lost all information about the geometric primitives except for the last(because the stack contains only one thing)(which is not the case).

IMHO it would be more logical that it would look like this:

glPushName(x);

drawsomething();

glPushName(x+1);

drawsomething2();

glPushName(x+2);

drawsomething3();

[..]What's wrong with my way of thinking?

Thanx Hylke

I would like to use selection for picking.

As I understand, every geometric primitive which is in the viewing volume, causes a hit right?

If you have a couple of triangles, which are only one name, they only cause one hit.

My OpenGL redbook says this about glLoadname:

Replaces the value at the top of the name stack with name.[..]So glLoadName(blaat); would equal to:

glPopName();

glPushName(blaat);But here's the thing I don't understand.

All my code examples of my book look like this:

glLoadName(x);

drawsomething();

glLoadName(x+1);

drawsomething2();

glLoadName(x+2);

drawsomething3();

[..]But doesn't that *delete* the last value in the stack and then add a new one to it?

So if I understand it right, it would lost all information about the geometric primitives except for the last(because the stack contains only one thing)(which is not the case).

IMHO it would be more logical that it would look like this:

glPushName(x);

drawsomething();

glPushName(x+1);

drawsomething2();

glPushName(x+2);

drawsomething3();

[..]What's wrong with my way of thinking?

Thanx Hylke