• Advertisement
Sign in to follow this  

Help with GLUT

This topic is 3346 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

What I would like to know is what is the difference of this?
Main.cpp

void handleResize(int w, int h)
{
}

//......

//Main
glutReshapeFunc(handleResize);


and this
Video.cpp
void handleResize(int w, int h)
{
}

Main.cpp
//....
//Main
glutReshapeFunc(video.handleResize);

The top one works but what I want is to have all video related functions in my video class but if I do it the bottom way I get a error saying video.handleResize(int w,int h) missing arguments or something like that. Whats different other than it being in another class?

Share this post


Link to post
Share on other sites
Advertisement
you could make the function static and do

glutReshapeFunc(video::handleResize);




if video is the name of the class. You could create an instance of the class and do glutReshapeFunc(a.handleResize);

both methods work if that method is static, but if it's not, the first will return an error about accessing a non-static function statically, and the second will return


argument of type ‘void (video::)(int, int)’ does not match ‘void (*)(int, int)’


which is what I'm guessing is your error.

Share this post


Link to post
Share on other sites
Thx for the help. Ill try that right after I finish reinstalling my stuff. One little crash and I had to reformat my drive. -sign-

Share this post


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

  • Advertisement