object - Sending a class member function as an argument of glutDisplayFunc -


i trying send member function of class vertices argument of glutdisplayfunc in main getting error :

error 1 error c3867: 'vertices::draw': function call missing argument list; use '&vertices::draw' create pointer member

2   intellisense: pointer bound function may used call function   c:\users\danish\documents\visual studio      

please me out.....the code below

 #include <glut.h>  class vertices { private:     float x1;     float x2;     float y1;     float y2;  public:     vertices(float a, float b, float c, float d)     {     x1 = a;     y1 = b;     x2 = c;     y2 = d;     } void draw()      {     glclear(gl_color_buffer_bit);                 glcolor3f(1.0, 1.0, 1.0);                  glbegin(gl_polygon);                 glvertex3f(x1,y1,0.0);                 glvertex3f(x2,y1,0.0);                 glvertex3f(x2,y2,0.0);                 glvertex3f(x1,y2,0.0);                  glend();                 glutswapbuffers();     } };  void timer(int iunused) { glutpostredisplay(); gluttimerfunc(30, timer, 10); }  void initialize() { glclearcolor(0.0, 0.0, 0.0, 0.0); glmatrixmode(gl_projection); glloadidentity(); glortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); }  int main(int iargc, char** cppargv)  {  glutinit(&iargc, cppargv); glutinitdisplaymode(glut_double| glut_rgb); glutinitwindowsize(250, 250); glutinitwindowposition(200, 200); glutcreatewindow("xoax.net"); initialize();  vertices newobject(0,0,0.1,0.1); glutdisplayfunc(newobject.draw); timer(0); glutmainloop(); return 0; } 


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -