glutDisplayFunc and member function...

Started by
1 comment, last by darkurizen 17 years, 10 months ago
Hi there, I'd like to use the glut functions from the tutorials (e.g. glutDisplayFunc, glutReshapeFunc, a.s.o.) in combination with member functions. For example I've created a viewer class, whose objects should contain the method that I want to be called by glutDisplayFunc: void viewer::start(int argc, char** argv) { (...) glutDisplayFunc(DrawGLScene); (...) } GLvoid viewer::DrawGLScene(GLvoid) { (...) } DrawGLScene here ist a public member function in the viewer class. The compiler tells me, that the argument of type 'GLvoid (viewer::)()' doesn't match 'void (*)()' I'm really a blockhead, so has anyone an idea how to solve this issue? Thanks a lot. darkurizen EDIT: I forgot to mention that I'm coding in C++ on a Mac ;)
Advertisement
You can't pass a pointer to a member function where a pointer to a free function is expected. The only function pointers which can be passed to glutDisplayFunc are those for free functions and static member functions.
Thank you, I marked the functions static and now it works.

Sort of obvious, but I was somehow blind ;)

Thanks.

This topic is closed to new replies.

Advertisement