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) –