C++ with glut

Hey I wanted to use C++ and implement window management using glut but with functions like glutDisplay() the call back function should be global…This means we can’t use member function of a class as call back function???

You can if you make them static, but then they are basically similar to being global. (You can’t access any non-static methods/properties from a static method).

One way of doing this would be just to have your global functions as callbacks, and then just have those globals pass them on to a method on an instance of your class.

Originally posted by Sandeep:
Hey I wanted to use C++ and implement window management using glut but with functions like glutDisplay() the call back function should be global…This means we can’t use member function of a class as call back function???

Or try a different library which supports
user definable contexts where you can
store c++ object pointers per window.

(If your on Win32 - here ya go:
http://www.mathies.com/cpw/ )

Regards,
Jim