Because methods are not same as functions. Methods require an instance to be called and therefore they can’t be used as callback function (in this case). However it should be possible to use static methods as they don’t have to be called by an instance.
edit: Or other possibility… declare a normal callback function which calls a given method of your class (on some provided instance)
Thanks… I think that you said the solution… a class with a static member that acts as callback and there a call to the member of the other class seems a good solution…
You can use non-static class methods as callbacks, but these callbacks must support “thiscall” calls. I believe glut doesn’t support that since it’s not object-oriented library.
You can use static member functions as glut callback. From this static member function you can call your other member function. For this, you have to get an object instance from somewhere (global variable, static variable, singleton pattern, …).
You can do the same with a global (non-member) function.
The solution with operator() and the one with mem_fun_ref are wrong. They only work with template libraries.