Đề bài: Vẽ một tứ giác dùng thư viện glut.h
Lỗi: error C3867: 'GUI::display': function call missing argument list; use '&GUI::display' to create a pointer to member
Thanks for reading!
Code:
#include<iostream> #include<glut.h> using namespace std; class GUI { public: int W,H; GUI() { W=800; H=600; glClearColor(0,0,0,0); gluOrtho2D(-W,W,-H,H); glMatrixMode(GL_PROJECTION); } void display() { glBegin(GL_POLYGON); glVertex2d(-500,300); glVertex2d(500,300); glVertex2d(500,-300); glVertex2d(-500,-300); glEnd(); glFlush(); } }; int main(int argv,char **argc) { GUI ob; glutInit(&argv,argc); glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE); glutInitWindowSize(ob.W,ob.H); glutInitWindowPosition(100,100); glutCreateWindow("Tu giac"); glutDisplayFunc(ob.display); //Error glutMainLoop(); return 0; }
Thanks for reading!