2016-04-19 20 views
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ポインタを必要なものに変換できません。 メンバー関数ポインタのこの障害を回避するにはどうすればよいですか?

+0

glutDisplayFunc([&Mymodel](){Mymodel.Draw();}) – Ricko

+0

ラムダが関数ポインタに変換できないため、動作しません。彼らは何かを捕まえる。 –

答えて

0

私はasmjitライブラリがあなたのためにできると思います。

関連する問題