Original Post
Hi, I'm trying to create a menu with glut (although probably not glut specific) and Cpp but it's giving me an error at compile. I'm not completely certain but I think it has something to do with a callback within a class. Basically the code is supposed to bring up a menu, which changes some variables depending on which option you select. In my menu.cpp the error: Can someone help? Thanks.
void Menu::createMenu(void) {
menu = glutCreateMenu(processEvents); //error c2664
glutAddMenuEntry("Red", 0);
glutAddMenuEntry("Green", 1);
glutAddMenuEntry("Blue", 2);
glutAttachMenu(GLUT_RIGHT_BUTTON);
}
void Menu::processEvents(int event) {
switch(event) {
case 0: bgRed = 1;
bgGreen = 0;
bgBlue = 0;
break;
case 1: bgRed = 0;
bgGreen = 1;
bgBlue = 0;
break;
case 2: bgRed = 0;
bgGreen = 0;
bgBlue = 1;
break;
default: break;
}
}
error C2664: 'glutCreateMenu' : cannot convert parameter 1 from 'void (int)' to 'void (__cdecl *)(int)'
None of the functions with this name in scope match the target type