PDA

View Full Version : Is there any constant in OpenGL containing the maximum depth of the name stack?



earth_walker
06-20-2003, 10:48 AM
Thank you!

yaro_dup1
06-20-2003, 11:43 AM
GL_MAX_NAME_STACK_DEPTH

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

cheers,
yaro

earth_walker
06-20-2003, 12:24 PM
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!

yaro_dup1
06-21-2003, 02:33 AM
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

earth_walker
07-10-2003, 06:30 AM
Originally posted by glYaro:
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




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!