PDA

View Full Version : C++ with glut



Sandeep
05-08-2002, 11:03 AM
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???

Deiussum
05-08-2002, 11:15 AM
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.

jmathies
05-08-2002, 01:54 PM
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