hi!
I would like to implement a GLGroup class which would contain a collection of OPenGL objects (spheres, cubes etc).
In this class I see that there would be a pointer keeping track of objects list and some members like
GLGroup::addobject
and one
GLGroup::deleteobject
My main problem is that I want to be able to select those objects on the screen and tell which one I have selected somehow
so in the selection mode I will have a
loop over objects
glPushName(i)
But I add/delete objects from the list how do I keep track of their names?
dorbie
August 20, 2004, 7:23am
2
You associate the names with the objects, it is entirely up to you what you want to do with the names. The name does not have to be a list index, it could be cast from a pointer for example.
could you please give me a brief example of how you would write this class?
dorbie
August 20, 2004, 1:47pm
4
I’m not talking about writing a class, I’m talking about storing a pointer to your class as the name.
Or you could use an array of pointers and use i as the index you sent to the pick stack, however I’d just go with the direct cast and cast back.
I don’t understand what you mean by “the direct cast and cast back” can you pls give me an example?
Yeah dorbie, give him an example
I’m going to answer, but I also want a moderator to move the answer to the “for beginners” section.
Anyway:
Edit by moderator: Look for this thread in the beginners section for the answer.