Sign in to follow this  

glutDisplayFunc and member function...

This topic is 4199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ;)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this