From c4566bcc61f2973149436f70e3042c4860d3d899 Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Sat, 8 Oct 2011 11:21:18 +0800 Subject: [PATCH] --- scene.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/scene.c b/scene.c index c41c095..3e7e8da 100644 --- a/scene.c +++ b/scene.c @@ -221,21 +221,64 @@ void processLightEvents(int id) { } void makeMenu() { - int main, object, material, texture, gtexture, light; + //int main, object, objectsize, material, texture, gtexture, light; - object = glutCreateMenu(processObjectEvents); - for ( int i = 0; objectMenuEntries[i]; i++ ) { - glutAddMenuEntry( objectMenuEntries[i], i ); - } + glutCreateMenu(processMainEvents); + int objectSize = sizeof(objectMenuEntries) / sizeof(objectMenuEntries[0]); + int numMenus = objectSize/10 + 1; + int objectSubmenu[numMenus]; - glutCreateMenu(processMainEvents); + // Create the n-(n+10) menus + for ( int i = 0; i < numMenus; i++ ) { + + objectSubmenu[i] = glutCreateMenu(processObjectEvents); + + for ( int j = 0; j < (i + 1) * 10; j++ ) { + + if ( objectMenuEntries[j] ) { + glutAddMenuEntry( objectMenuEntries[j], j + 1 ); + } else { + break; + } + + } + + } + + // Create the overmenu + int objectMenu = glutCreateMenu(processObjectEvents); + for ( int i = 0; objectSubmenu[i]; i++ ) { + glutAddSubMenu( (i + 1) * 10, objectSubmenu[i] ); + } + + glutAddSubMenu("Objects", objectMenu); glutAddMenuEntry("Exit", 99); + + + + glutAttachMenu(GLUT_RIGHT_BUTTON); } + +/*void createGLUTMenus() { + + int menu,submenu; + + submenu = glutCreateMenu(processMenuEvents); + glutAddMenuEntry("Red",RED); + glutAddMenuEntry("Blue",BLUE); + glutAddMenuEntry("Green",GREEN); + + menu = glutCreateMenu(processMenuEvents); + glutAddMenuEntry("White",WHITE); + glutAddSubMenu("RGB Menu",submenu); + glutAttachMenu(GLUT_RIGHT_BUTTON); +*/ + void display() { // You probably want to change both of the following. glClear(GL_COLOR_BUFFER_BIT); -- 2.20.1