View Full Version : GLGroup class

08-20-2004, 07:13 AM

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
and one

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

But I add/delete objects from the list how do I keep track of their names?

08-20-2004, 07:23 AM
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.

08-20-2004, 09:28 AM
could you please give me a brief example of how you would write this class?

08-20-2004, 01:47 PM
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.

08-21-2004, 12:10 AM
I don't understand what you mean by "the direct cast and cast back" can you pls give me an example?

08-21-2004, 04:31 AM
Yeah dorbie, give him an example :p

08-21-2004, 06:31 PM
I'm going to answer, but I also want a moderator to move the answer to the "for beginners" section.


Edit by moderator: Look for this thread in the beginners section for the answer.