Is there any constant in OpenGL containing the maximum depth of the name stack?

Thank you!

GL_MAX_NAME_STACK_DEPTH

In Microsoft implementation it equals to:
3383 (0x0D37).

cheers,
yaro

Thank you!

Another problem rises. I check the variable in Delphi 5.0, it shows 128. However, I want to make a program that plots a lot of points in window, when user mouse click on the points, their information such as coordinate can be return. The number of points can easily go to 300…

Is there any way to solve the problem?

Thank you!

Of course.

In that case You can’t use glPushName every time to specify the point coordinates. You have to use glLoadName(GLuint name). As a parameter You have to pass the point coords but that function has only one parameter so You need to convert the point coords = (GLuint x, GLuint y) to one GLuint variable, for example: name = y*SCREEN_WIDTH + x.

So Your code should be sth like that:

glInitNames();
glPushName(0);

// for every point in the GL window
glLoadName(y*SCREEN_WIDTH + x);
RenderPoint(x, y);

Then You have to check what is the value of buffer[0] (Selection buffer).

Cheers,
yaro

Originally posted by glYaro:
[b]Of course.

In that case You can’t use glPushName every time to specify the point coordinates. You have to use glLoadName(GLuint name). As a parameter You have to pass the point coords but that function has only one parameter so You need to convert the point coords = (GLuint x, GLuint y) to one GLuint variable, for example: name = y*SCREEN_WIDTH + x.

So Your code should be sth like that:

glInitNames();
glPushName(0);

// for every point in the GL window
glLoadName(y*SCREEN_WIDTH + x);
RenderPoint(x, y);

Then You have to check what is the value of buffer[0] (Selection buffer).

Cheers,
yaro

[/b]

Thank you! Good idea. In last two weeks I was sticking in Delphi study because I’m using Delphi to write OpenGL code. Now I’m able to apply OpenGL under Delphi basically(though not very professional).
I will read the specification of functions and try this method.
Thank you!