在我的课堂上使用glutDisplayFunc(显示) [英] use glutDisplayFunc(display) in my class
问题描述
大家好
我用一个类用C ++编写opengl程序,我想用 glutDisplayFunc(显示)
和我的显示功能:
void graphic :: dispaly()
{
glClear(GL_COLOR_BUFFER_BIT);
// 调用函数
glutSwapBuffers();
}
现在,我遇到这个错误:
3智能感知:参数void(graphic :: *)()类型与void(*)()类型的参数不兼容
我用谷歌搜索这个解释:
http://stackoverflow.com/questions/ 3589422 / using-opengl-glutdisplayfunc-in-class [ ^ ]
但我无法理解!请帮我正确使用此功能。
(抱歉我的英文不好:))
正如理查德所说,将图形类中的显示功能声明为:
< pre lang =c ++> class graphic
{
...
static void display();
};
,事情应该有效。
Hi all
I use a class to write opengl program in C++,I want to use glutDisplayFunc(display)
and this my display function:
void graphic::dispaly()
{
glClear(GL_COLOR_BUFFER_BIT);
//call a function
glutSwapBuffers();
}
Now ,I face this error:
3 IntelliSense: argument of type "void (graphic::*)()" is incompatible with parameter of type "void (*)()"
I googled and fount this solation:
http://stackoverflow.com/questions/3589422/using-opengl-glutdisplayfunc-within-class[^]
but I cant understand it!,please help me to use this function correctly .
(Sorry for my bad English:))
As Richard said, declare the display function in your graphic class as:
class graphic { ... static void display (); };
and things should work.
这篇关于在我的课堂上使用glutDisplayFunc(显示)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!