PDA

View Full Version : gl function,how to???



zeytin
07-31-2009, 08:58 AM
i have a quick question,

does anybody know if we can use this function like that?

glutDisplayFunc(display); instead

glutDisplayFunc(aClass.display());

(aClass is a class :))is usage above legal?

Flavious
07-31-2009, 09:58 AM
It is if display() is a static method in C++.

(To be more precise I should probably say that it's legal if aClass.display() evaluates to a pointer to static method.)

Stuart McDonald
08-01-2009, 01:22 AM
The reason you can't do that and need to use a static is non-static methods have a 'this' parameter i.e. the object this method is being called on. If you are wanting to wrap stuff in a class have a look at this thread. (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=49624&Number=2559 41)

zeytin
08-02-2009, 06:53 AM
Flavious and Stuart McDonald ,

thanks, for reply.

and thread is about exactly what i am trying to find out.