PDA

View Full Version : need help...



zombie
10-19-2004, 04:13 PM
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.

gmeed
10-19-2004, 07:19 PM
Since plot is a member function, it can't be represented by a simple function pointer as glutDisplayFunc requires.

(I just glanced at the rest of the code, but it looks like you're leaking display lists, creating a new one every time plot is called.)