Sign in to follow this  
arczev

Picking problem

Recommended Posts

Hi, Picking procedure from my game looks like this(i had copied it from tut) . . . hits= glRenderMode (GL_RENDER); if (hits != 0) { ptr = (GLuint *) buffer; minZ = 0xffffffff; for (i = 0; i < hits; i++) { names = *ptr; ptr++; if (*ptr < minZ) { numberOfNames = names; minZ = *ptr; ptrNames = ptr+2; } ptr += names+2; } ptr = ptrNames; Process(numberOfNames,ptr); . . . This procedure returns names of objects which are "on the top". Do anyone know how to change it to return all names? thx 4 respons

Share this post


Link to post
Share on other sites
Looks like the Lighthouse3D code :) If you took it directly from red book, this explanation might help.

Think about it logically, if you want all the names and not just the closest name, then you will have to save them from the inner loop. You shouldn't check for if "(*ptr < minZ)" but instead just return them all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this