opengl - Objective C glutDisplayFunc with method -


how can use objective c method argument glutdisplayfunc (and functions it)? i'm quite new objc, don't know how works

in c++, can pass in void, in objc, tried this:

    //...     glutdisplayfunc([self display]);     //...  -(void) display{     glutpostredisplay(); } 

i've tried static methods

    //...     glutdisplayfunc([self display]);     //...  +(void) display{     glutpostredisplay(); } 

but every time error "passing 'void' parameter incompatible type void(*)(void)". thought pass in void.

so, how can make work (it has method)

in c++, can pass in void

no, can't.

so, how can make work (it has method)

you can't. you're interested in known closure or delegate, glut take global scope c style callback functions. best thing write global scope wrapper calling convention compatible c, calls method of global scope class instance.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -