我有一个 C++ 类,其中包含我想传递给 glutDisplayFunc() 的绘制函数。glutDisplayFunc 将函数指针 (void (*)() ) 作为其参数。我努力了 :
Model myModel(pathToTextures);
//Model contains the Draw function that draws the vertices and the textures
std::function<void(void)> myfunc=std::bind(&Mymodel::Draw,&modelna);
glutDisplayFunc(myfunc);
编译器无法将 std::function 指针转换为所需的。我怎样才能绕过这个成员函数指针的障碍?