Callback function in freeglut from object

I'm using MSVC++ and freeglut in order to use openGL. Now, I have a class called Camera, which is pretty simple, but it also holds the function for the reshaping of my window.

My question is: how can I set glutReshapeFunc(void (*callback)(int,int)) to my function in my camera?

I have the following code, which won't work, because of a compiler error:

int main(int argc, char **argv)
{
    Camera *camera = new Camera();
    glutReshapeFunc(camera->ReshapeCamera);
}

and my Camera class looks like this in Camera.h:

class Camera
{
public:
    Camera(void);
    ~Camera(void);
    void ReshapeCamera(int width, int height);
};

Maybe this is just a more general callback question, but the only thing I found on the internet was creating some wrapper class around the callback. But it doesn't look like this should be so hard. Заранее спасибо.

8
задан Marnix 15 February 2011 в 19:02
поделиться