Skip to main content
GameDev.net gamedev.net
🔒 Locked

Help with GLUT

Started by LostSnow25 Dec 21, 2008 at 4:53 PM 1 replies 600+ views
Original Post
LostSnow25
LostSnow25
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?
Viral_Fury
Viral_Fury
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.
LostSnow25
LostSnow25
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-

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.