0
我实现了一个名为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应用程序的类中实现此任务?
[在类中使用OpenGL glutDisplayFunc]的可能重复(http://stackoverflow.com/questions/3589422/using-opengl-glutdisplayfunc-within-class) –