void GlutViewer::ClearDrawModes() { for (unsigned int i=0; i<m_NDrawModes; i++) { glutRemoveMenuItem(1); } m_NDrawModes = 0; m_DrawModeNames.clear(); }
void GlutViewer::clear_draw_modes() { for (unsigned int i=0; i<n_draw_modes_; ++i) glutRemoveMenuItem(1); n_draw_modes_ = 0; draw_mode_names_.clear(); }
void GlutMenu::reset() { if (_menuID!=-1) { glutSetMenu(_menuID); int n = glutGet(GLenum(GLUT_MENU_NUM_ITEMS)); for (int i=0; i<n; i++) glutRemoveMenuItem(1); } resetList(); }
void MenuInit() { int M = glutCreateMenu(MenuCheck); int Msub = glutCreateMenu(SubMenuCheck); glutSetMenu(Msub); glutAddMenuEntry("Submenu!", 5); glutSetMenu(M); glutAddMenuEntry("Made by tapin13", 1); glutAddMenuEntry("Lesson 08", 0); glutAddSubMenu("Advanced", Msub); glutRemoveMenuItem(1); glutAttachMenu(GLUT_RIGHT_BUTTON); //glutDetachMenu(GLUT_RIGHT_BUTTON); }
void keyboard(unsigned char key, int x, int y) { switch(key) { case '+': n++; if (n > 3) n = 3; glutRemoveMenuItem(5); sprintf(buf, "Depth of sponge: %d", n); glutAddMenuEntry(buf, 5); glutPostRedisplay(); break; case '-': n--; if (n < 0) n = 0; glutRemoveMenuItem(5); sprintf(buf, "Depth of sponge: %d", n); glutAddMenuEntry(buf, 5); glutPostRedisplay(); break; } }
void myMenu(int value) { if(value == 1) { n = 0; glutRemoveMenuItem(5); sprintf(buf, "Depth of sponge: %d", n); glutAddMenuEntry(buf, 5); glutPostRedisplay(); } if(value == 2) { n = 1; glutRemoveMenuItem(5); sprintf(buf, "Depth of sponge: %d", n); glutAddMenuEntry(buf, 5); glutPostRedisplay(); } if(value == 3) { n = 2; glutRemoveMenuItem(5); sprintf(buf, "Depth of sponge: %d", n); glutAddMenuEntry(buf, 5); glutPostRedisplay(); } if(value == 4) { n = 3; glutRemoveMenuItem(5); sprintf(buf, "Depth of sponge: %d", n); glutAddMenuEntry(buf, 5); glutPostRedisplay(); glutPostRedisplay(); } }
/* ARGSUSED1 */ void gokey(unsigned char key, int x, int y) { char str[100]; int mods; mods = glutGetModifiers(); printf("key = %d, mods = 0x%x\n", key, mods); if (mods & GLUT_ACTIVE_ALT) { switch (key) { case '1': printf("Change to sub menu 1\n"); glutChangeToSubMenu(1, "sub 1", submenu); break; case '2': printf("Change to sub menu 2\n"); glutChangeToSubMenu(2, "sub 2", submenu); break; case '3': printf("Change to sub menu 3\n"); glutChangeToSubMenu(3, "sub 3", submenu); break; case '4': printf("Change to sub menu 4\n"); glutChangeToSubMenu(4, "sub 4", submenu); break; case '5': printf("Change to sub menu 5\n"); glutChangeToSubMenu(5, "sub 5", submenu); break; } } else { switch (key) { case '1': printf("Change to menu entry 1\n"); glutChangeToMenuEntry(1, "entry 1", 1); break; case '2': printf("Change to menu entry 2\n"); glutChangeToMenuEntry(2, "entry 2", 2); break; case '3': printf("Change to menu entry 3\n"); glutChangeToMenuEntry(3, "entry 3", 3); break; case '4': printf("Change to menu entry 4\n"); glutChangeToMenuEntry(4, "entry 4", 4); break; case '5': printf("Change to menu entry 5\n"); glutChangeToMenuEntry(5, "entry 5", 5); break; case 'a': case 'A': printf("Adding menu entry %d\n", item); sprintf(str, "added entry %d", item); glutAddMenuEntry(str, item); item++; break; case 's': case 'S': printf("Adding submenu %d\n", item); sprintf(str, "added submenu %d", item); glutAddSubMenu(str, submenu); item++; break; case 'q': printf("Remove 1\n"); glutRemoveMenuItem(1); break; case 'w': printf("Remove 2\n"); glutRemoveMenuItem(2); break; case 'e': printf("Remove 3\n"); glutRemoveMenuItem(3); break; case 'r': printf("Remove 4\n"); glutRemoveMenuItem(4); break; case 't': printf("Remove 5\n"); glutRemoveMenuItem(5); break; } } }
/* * Class: gruenewa_opengl_GLUT__ * Method: glutRemoveMenuItem * Signature: (I)V */ JNIEXPORT void JNICALL Java_gruenewa_opengl_GLUT_00024_glutRemoveMenuItem (JNIEnv * jenv, jobject jobj, jint arg1) { glutRemoveMenuItem(arg1); }