need help

Hay,guys!
I would appreciate any of you if can give me some comments about the following question.

I write a class for circles as following;
class glCircle
{
public:
glCircle(GLint x=0,GLint y=0,GLint r=50);
void setColor(GLfloat r=1.0,GLfloat g=0, GLfloat b=0);
void plot(void);

private:
GLint xCenter;
GLint yCenter;
GLint radius;
void setPixel(GLint xCoord,GLint yCoord);
void midpoint();
void plotPoints(screenPt circPt);
};

and plot function like this,

void glCircle::plot(void)
{
//Clear display window
glClear(GL_COLOR_BUFFER_BIT);

//activate the antialias
glEnable(GL_POINT_SMOOTH);

//declare the identifiers
GLuint regCircle;

//get an identifier for the circle routine
regCircle=glGenLists(1);
glNewList(regCircle,GL_COMPILE);
midpoint();
glEndList();

//Call lists here
glCallList(regCircle);

//Process all OpenGl routines as quickly as possible
glFlush();
}

Now I want to call this plot in main function as follow,
glCircle circle;
glutDisplayFunc(circle.plot);

when I compile using VC++, the following error occurs,

glutDisplayFunc’ : cannot convert parameter 1 from ‘void (void)’ to ‘void (__cdecl *)(void)’
None of the functions with this name in scope match the target type.

Did any of you have the situation before?

Thanks in anticipation.

This isn’t an advanced OpenGL question. It’s a C++ question. Anyway, IIRC (I don’t use GLUT) glutDisplayFunc expects an argument of the form “void function(void)”. You’re passing a member function. The first parameter of your member function argument is an implicit “this” pointer, so “circle.plot” is actually void plot(circle->this, void). To fix this you have several options:

(i) Make plot() a global function and a friend of Circle.
(ii) Make plot() a global function and make midpoint() a public function.
(iii) Use std::mem_fun.
(iv) Create a static member function of your class which calls plot() since static member functions don’t have an implicit “this” pointer.

Also, you don’t want to compile a new list each time you plot the circle. That’s way too slow. Create the list once e.g. at Circle object instantiation and call it each time you plot.

Hope that helps.