Selection, Name stack, Hits - Newbie question

Started by
12 comments, last by Darjk 22 years, 2 months ago
Okay I found 1 problem, I messed up a stupid PopMatrix, PushMatrix which was messing up the naming during the tile rendering.

Now it is always returning 0.

Also I tried clicking on the cornor of a tile it only returned 1 result, but I think I have an idea now!

Ill let you know how it goes in a few mins.


Edit:

Nope, still always returning 1.
I may have my tree naming setup incorrectly, either that or I'm not naming correctly for each individual tile ?

Edited by - Darjk on February 18, 2002 5:23:47 AM


Edit #2:

Okay I'm not getting these results

Hits = 1
number of names for hit = 2

z1 is 4198027884;
z2 is 4216201336

the name is -1

the name is 0

It seems to be returning the -1 is just something I push onto the name stack and the 0 is the ground, still not giving me the tile name though

Edited by - Darjk on February 18, 2002 5:29:01 AM
Advertisement
Honestly, I don''t know. As long as you are placing a name on the stack before drawing your primitives, that name should show up in the hit record if that primitive is rendered (within the restricted window from gluPickMatrix).

Which leads to a last test : remove the call to gluPickMatrix and let it render the whole scene... you should have N hits, where N is the total number of names you picked.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Okay I finally figured it out.

The way I was drawing my tiles was incorrectly and I did not pick up on it

Basically I needed to put the glBegin(QUADS); inside the For loop instead of begining, drawing all tiles, then ending it.

I now get the following results:

Hits = 4
number of names for hit = 3

z1 is 4208480774;
z2 is 4216927619

the name is -1


the name is 0


the name is 5


number of names for hit = 3

z1 is 4198754167;
z2 is 4208480774

the name is -1


the name is 0


the name is 9


number of names for hit = 3

z1 is 4208480774;
z2 is 4216927619

the name is -1


the name is 0


the name is 1029


number of names for hit = 3

z1 is 4198754167;
z2 is 4208480774

the name is -1


the name is 0


the name is 1033


Thanks for all the help and testing suggestions.. very much appreciated!

You''ll probably hear from me in a couple days trying to work out what ever comes next
Thanks again Fruny!
remember glPushName has a limit to how far u can push glLoadName has no limit

http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement