我正在实现一个名为 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();
}
这是将在 MFC 应用程序中用于渲染创建窗口并在其上渲染 tiff 图像的类的一部分,但在该行glutDisplayFunc(RenderScene)
我得到错误
argument of type "void (FilesWorkFlow::*)()" is incompatible with parameter of type "void (__cdecl *)()"
甚至编写代码glutDisplayFunc((_cdecl)RenderScene)
也无济于事。如何解决此问题并在将用于 MFC 应用程序的类中实现此任务?