0
私はglutDisplayFunc()に渡したい描画関数を含むC++クラスを持っています。 glutDisplayFuncは引数として関数ポインタ(void(*)())をとります。私は試してみました:メンバー関数へのポインタを持つglutDisplayFunc()
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ポインタを必要なものに変換できません。 メンバー関数ポインタのこの障害を回避するにはどうすればよいですか?
glutDisplayFunc([&Mymodel](){Mymodel.Draw();}) – Ricko
ラムダが関数ポインタに変換できないため、動作しません。彼らは何かを捕まえる。 –