Joined
·
5,282 Posts
I'm writing an opengl app (GLUT) in C++ and I'm getting an error when attempting to set the callbacks. The signature for the first is this
Code:
In one of my classes I have a function draw declared as such (irrelevant portions omitted)
Code:
In my implementation I have the following
Code:
On compilation, I get the following error
Code:
If I'm reading that error correctly its the fact that the function is a member of a class that's causing the problem. If so, how can I set a member function as the glut callback? If not, what is the problem? Thanks in advance
Code:
Code:
void glutDisplayFunc(void (*func)(void));
Code:
Code:
#ifndef _GRAPHICS_ENGINE_H
#define _GRAPHICS_ENGINE_H
class GraphicsEngine{
public:
void draw(void);
};
#endif
Code:
Code:
void GraphicsEngine::draw(void){
}
void GraphicsEngine::init(int *argc, char **argv){
glutDisplayFunc(draw);
}
Code:
Code:
src/GraphicsEngine.cpp:42: error: argument of type 'void (GraphicsEngine::)()' does not match 'void (*)()'