q66680 wrote on Thursday, March 13, 2014:
hi.i want to put my cbfuns into my class.something like that:
class scene{
public:
virtual void mouse_callback(GLFWwindow*, int, int, int);
};
i tried a few case.But no lucky.i always get func signature error something like:
error: cannot convert ‘void (scene::)(GLFWwindow, int, int, int)’ to ‘GLFWmousebuttonfun {aka void ()(GLFWwindow, int, int, int)}’ for argument ‘2’ to ‘void (* glfwSetMouseButtonCallback(GLFWwindow*, GLFWmousebuttonfun))(GLFWwindow*, int, int, int)’
So i wonder whether it is possible.if so how?
it might be better to add this signature to all cbfuns. for above e.g:
void mouse_callback(GLFWwindow*, int, int, int,void* userdata);
i think @userdata signature above have many use case and many help to developer.
Doing so developer can share his data along cbfuns.
i noticed wayland/weston use this approach for its cbfuns.
What about you? performance may be affected.