-
October 4th, 2004, 06:38 PM
#1
OpenGL glutDisplayFunc()
Hi there,
I want to set the OpenGL paint function by calling
Code:
glutDisplayFunc( paintGL() )
paintGL(void) returns void and includes glBegin() & glEnd() etc...
My compiler (VC++ 6) says:
"cannot convert parameter 1 from 'void (void)' to 'void (__cdecl *)(void)"
This project should be independant of MFC and MS specific functions. Calling
Code:
glutDisplayFunc( &paintGL() )
does not change anything.
This function looks like followed:
Code:
void View::paintGL(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(0,0,5,0,0,0,0,1,0);
glBegin(GL_LINES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glutSwapBuffers();
glEnd();
glFlush();
}
Do you have a clue what could be wrong?
Thank you alot in advance!!
Holger
-
October 5th, 2004, 05:01 AM
#2
Re: OpenGL glutDisplayFunc()
glutDisplayFunc() is a C function which does not accept member functions (C++ calling conventions). Try making it a global function for testing purposes. Maybe making it static could solve the problem, but I'm not sure about this.
-
October 5th, 2004, 05:06 AM
#3
Re: OpenGL glutDisplayFunc()
Try:
Code:
glutDisplayFunc( &View::paintGL )
Regards,
-
October 5th, 2004, 08:36 AM
#4
Re: OpenGL glutDisplayFunc()
Thanks guys,
I now declared them as static. That helped!
Thanks alot!
Holger
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|