Hey i changed my code as you suggested to the following and I'm still getting
errors.
int Creator::mazemain() { //glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(windowSizeX, windowSizeY); // Set Window size according to global variables windowSizeX, windowSizeY glutCreateWindow("Maze"); // Create game window, called "Maze" initRendering(); //Set handler functions glutDisplayFunc(&drawScene); // draws display to screen glutWarpPointer((windowSizeX/2), (windowSizeY/2)); // warps pointer X, Y location relative to bottom left of screen (in this case middle of screen) glutPassiveMotionFunc(&processMouseMotion); // allows program to process passive mouse motion, handled with processMouseMotion glutMouseFunc(&processMouseClick); glutKeyboardFunc(&handleKeypress); // enables program to process game effects in response to button presses glutSpecialFunc(&processSpecialKeys); // enables use of special keys such as directional and F locked keys for game functionality glutIdleFunc(&drawScene); // used for pausing game while menu is being used glutReshapeFunc(&handleResize); // handles resizing of game window // allows the program to utilise menu functionality glutMainLoop(); return 0;}
and i got the following error messages:
error C2276: '&' : illegal operation on bound member function expression
error C2276: '&' : illegal operation on bound member function expression
error C2276: '&' : illegal operation on bound member function expression
error C2276: '&' : illegal operation on bound member function expression
etc
This error was on each of those lines i just changed and put the &function name.
I tried a similar version as follows:
int Creator::mazemain() { //glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(windowSizeX, windowSizeY); // Set Window size according to global variables windowSizeX, windowSizeY glutCreateWindow("Maze"); // Create game window, called "Maze" initRendering(); //Set handler functions glutDisplayFunc(&Creator::drawScene); // draws display to screen glutWarpPointer((windowSizeX/2), (windowSizeY/2)); // warps pointer X, Y location relative to bottom left of screen (in this case middle of screen) glutPassiveMotionFunc(&Creator::processMouseMotion); // allows program to process passive mouse motion, handled with processMouseMotion glutMouseFunc(&Creator::processMouseClick); glutKeyboardFunc(&Creator::handleKeypress); // enables program to process game effects in response to button presses glutSpecialFunc(&Creator::processSpecialKeys); // enables use of special keys such as directional and F locked keys for game functionality glutIdleFunc(&Creator::drawScene); // used for pausing game while menu is being used glutReshapeFunc(&Creator::handleResize); // handles resizing of game window // allows the program to utilise menu functionality glutMainLoop(); return 0;}
and i got these errors.
error C2664: 'glutTimerFunc' : cannot convert parameter 2 from 'void (__thiscall Creator::* )(int)' to 'void (__cdecl *)(int)'
error C2664: 'glutDisplayFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(void)' to 'void (__cdecl *)(void)'
error C2664: 'glutPassiveMotionFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(int,int)' to 'void (__cdecl *)(int,int)'
error C2664: 'glutMouseFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(int,int,int,int)' to 'void (__cdecl *)(int,int,int,int)'
error C2664: 'glutKeyboardFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(unsigned char,int,int)' to 'void (__cdecl *)(unsigned char,int,int)'
error C2664: 'glutSpecialFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(int,int,int)' to 'void (__cdecl *)(int,int,int)'
: error C2664: 'glutIdleFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(void)' to 'void (__cdecl *)(void)'
error C2664: 'glutReshapeFunc' : cannot convert parameter 1 from 'void (__thiscall Creator::* )(int,int)' to 'void (__cdecl *)(int,int)'
Any ideas ?? Sorry i don't understand what you are telling me to do BertS, i've only started c++/openGl this semeser. :(
Thanx