Jump to content
  • Advertisement
Sign in to follow this  
darkurizen

glutDisplayFunc and member function...

This topic is 4365 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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!