A GLUT menu question.

Started by
1 comment, last by n0t_l33t 23 years, 9 months ago
how do i set up a menu in GLUT, i thought i had it right, but appearently i don''t, so i could use some help. Here is what i want to have on my menu: Add Point Rotate Point ... Exit unfortantly, i can''t get it. Here is what i have for the menu, where am i screwing up. It is probably big.
    
*void glutMenu(void)
{
	int glut_menu[1];
	glut_menu[0] = glutCreateMenu(NULL);
	glutAddMenuEntry("Add Point",1);
	glutAddMenuEntry("Delete Point",2);
	glutAddMenuEntry("Scale",3);
	glutAddMenuEntry("Rotate",4);
	glutAddMenuEntry("Exit",5);
	glutAttachMenu(GLUT_LEFT_BUTTON);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
}
    
of course the exit should exit, and the other should call a function to do the specified command. I also call glutMenu(); in the main, but i don''t know what to do past that.
Advertisement
taken from one of the glut examples

void menu(int value)
{
switch(value) {
case 1:
twopass = 0;
break;
case 2:
twopass = 1;
break;
}
glutPostRedisplay();
}


// in the init code
glutCreateMenu(menu);
glutAddMenuEntry("GL_LINEAR depthcueing", 1);
glutAddMenuEntry("\"add fog\" post-render depthcueing", 2);
glutAttachMenu(GLUT_RIGHT_BUTTON);
I setup the menu like you said, but when i compile and begin to run the program, i get this error:

GLUT: Warning in (unamed): cannot attach menus in game mode.

now how do i fix this part?

This topic is closed to new replies.

Advertisement