Function pointers


Sorry this question is probably more of a general programming question, but I guess many people had the same problem like me when using glut callbacks:

I would like to create objects that wrap every single glut window. This means that I would like to create the glut window inside the constructor of an object and have separate callback-routines for every window.

How can I specify a callback routine which isn’t static??

Please help me 'cause I’m on that problem for a few days already!!!?!


You could use arrays of pointers to the callbacks… that’s how the scripting system was done in Descent 3. Kinda nifty, really

You’re right, but that’s not really an elegant solution… Sure there’s no other way??