glutDisplayFunc() - "Objective-C"
Hoping this is the right place to post this. If not my apologies up front and please direct accordingly 
I'm trying to convert some Opengl code from C to Objective-c . So far syntax wise things appear to be OK but I'm running into an error I cant figure out.
"invalid use of void expression"
I'm sure it's my lack of knowledge in Obj C at this stage and not knowing how to do proper C Callbacks most likely...still learning. Regardless, I was hoping that some of the more savvy verterans my be able to help me out.
FWIW, the implementation of the glutDisplayFunc is glutDisplayFunc(void (*func) (void));
With that in mind, I'm supecting that this allocation "myOGL *OGL = [[myOGL alloc] init];" maybe causing an issue since the OGL func is looking to receive a func pointer and/or that my Obj-C func (DrawGLScene) signature does not have (void) as a parameter of which I dont think is possible in Obj-C?
Anyway, any help or suggestions are most welcome and for the sake of space I only listed the most relative parts of the code. If you need to see more I can post the whole thing but I figured initially it would be more noise than anything else. Thanks

I'm trying to convert some Opengl code from C to Objective-c . So far syntax wise things appear to be OK but I'm running into an error I cant figure out.
"invalid use of void expression"
Code:
//--------------------------
// @implementation
//--------------------------
@interface myOGL : NSObject [b]//Possible culprit? OGL Object?[/b]
-(void) DrawGLScene {
glClear( GL_COLOR_BUFFER | GL_DEPTH_BUFFER_BIT);
..
glFlush();
}
//---------------------
// Main Code
//---------------------
int main(int argc, char * argv[]) {
..
myOGL *OGL = [[myOGL alloc] init];
..
glutDisplayFunc([OGL DrawGLScene]); [b]//Error here *Invalid use of void expression[/b]
..
return 0;
}FWIW, the implementation of the glutDisplayFunc is glutDisplayFunc(void (*func) (void));
With that in mind, I'm supecting that this allocation "myOGL *OGL = [[myOGL alloc] init];" maybe causing an issue since the OGL func is looking to receive a func pointer and/or that my Obj-C func (DrawGLScene) signature does not have (void) as a parameter of which I dont think is possible in Obj-C?
Anyway, any help or suggestions are most welcome and for the sake of space I only listed the most relative parts of the code. If you need to see more I can post the whole thing but I figured initially it would be more noise than anything else. Thanks
glutDisplayFunc() takes a C function as a parameter, not an ObjC method call, nor an ObjC method at all. You need to write a wrapper function.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| glutDisplayFunc fps limit? | SummerLand | 2 | 4,186 |
Nov 21, 2002 02:27 PM Last Post: Steven |
|

