I am implementing a class named FilesWorkFlow:
//this function is called by other functions of the class to set openGL data type
//based on GDAL data type
void FilesWorkFlow::setOpenGLDataType(void)
{
switch (eType)
{
case GDT_Byte:
type = GL_UNSIGNED_BYTE;
break;
case GDT_UInt16:
type = GL_UNSIGNED_SHORT;
break;
case GDT_Int16:
type = GL_SHORT;
break;
case GDT_UInt32:
type = GL_UNSIGNED_INT;
break;
case GDT_Int32:
type = GL_INT;
}
}
//this function is called by other functions of the class to draw scene
void FilesWorkFlow::RenderScene(void)
{
GLint iWidth = (GLint)RasterXSize;
GLint iHeight = (GLint)RasterYSize;
setOpenGLDataType();
glClear(GL_COLOR_BUFFER_BIT);
glRasterPos2i(0,0);
glDrawPixels(iWidth,iHeight,format,type,pImage);
glFlush();
}
//this function is called by other functions of the class to setup the
//rendering state
void FilesWorkFlow::SetupRC(void)
{
glClearColor(0.0f,0.0f,0.0f,1.0f);
}
void FilesWorkFlow::Show(void)
{
int argc = 1;
char **argv;
argv[0] = "OPENGL";
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE);
glutCreateWindow("Image");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
}
This is part of the class that will be used in a MFC application to render a create a window a render a tiff image on it but at the line glutDisplayFunc(RenderScene)
I get the error
argument of type "void (FilesWorkFlow::*)()" is incompatible with parameter of type "void (__cdecl *)()"
even writing the code as glutDisplayFunc((_cdecl)RenderScene)
didn't help. How can I fix this problem and implement this task in a class that will be used in MFC applications?
First to get that misconception out of the way: GLUT is not part of OpenGL and you don't have to use it!
You can't mix GLUT and MFC. Both GLUT and MFC do about the same things:
You can't have two different things in the same program try to do the very same thing.
Anyway that error you're getting tells you the following:
Or in other words: What you try to do is impossible (without building some wrappers or use some dirty hacks).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.