X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=a1b52b356853fc9d60dcd74023e866e6e999029c;hb=6a7fd6316192537bf177867f3be0b89a54d3546d;hp=a35d885bf367fda0e9ba9a13309f188f7ada97a3;hpb=1f4718a29c0c386bd93e10f88dce8b9bb2f171b5;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index a35d885..a1b52b3 100644 --- a/scene.c +++ b/scene.c @@ -221,21 +221,66 @@ 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++ ) { + char name[10]; + sprintf(name,"%d",(i + 1) * 10); + glutAddSubMenu( name, 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);