コード例 #1
0
ファイル: main.cpp プロジェクト: bkzl/cottages
// inits - menu, objects, lights
void init_menu() {
	int submenu1 = glutCreateMenu(change_ground_color);
	int submenu2 = glutCreateMenu(change_background_color);
	int submenu3 = glutCreateMenu(change_shape);
	
	glutSetMenu(submenu1);
	glutAddMenuEntry("Red", 1);
	glutAddMenuEntry("Green", 2);
	glutAddMenuEntry("Blue", 3);
	glutAddMenuEntry("Reset", 4);
	glutSetMenu(submenu2);
	glutAddMenuEntry("Red", 1);
	glutAddMenuEntry("Green", 2);
	glutAddMenuEntry("Blue", 3);
	glutAddMenuEntry("Reset", 4);
	glutSetMenu(submenu3);
	glutAddMenuEntry("Cottage", 1);
	glutAddMenuEntry("Diamonds", 2);
	glutCreateMenu(change_ground_color);
	glutCreateMenu(change_background_color);
	glutCreateMenu(change_shape);
	glutAddSubMenu("Ground color", submenu1);
	glutAddSubMenu("Background color", submenu2);
	glutAddSubMenu("Shape", submenu3);
	
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
コード例 #2
0
void BuildMenu(){
	// Create a menu and bind it to mouse right button.
	////////////////////////////
	int menu_main = glutCreateMenu(My_Menu);
	int menu_timer = glutCreateMenu(My_Menu);
	int menu_action = glutCreateMenu(My_Menu);

	glutSetMenu(menu_main);
	glutAddSubMenu("Action", menu_action);
	glutAddSubMenu("Timer", menu_timer);
	glutAddMenuEntry("Exit", MENU_EXIT);

	glutSetMenu(menu_action);
	glutAddMenuEntry("Walk",MENU_ACTION_WALK);
	glutAddMenuEntry("Run", MENU_ACTION_RUN);
	glutAddMenuEntry("Expecto Patronum", MENU_ACTION_PATRONUM);
	glutAddMenuEntry("Expecto Patronum Disappear", MENU_ACTION_PATRONUM_DISAPPEAR);
	glutAddMenuEntry("STOP ACTION", MENU_STOP_ACTION);

	glutSetMenu(menu_timer);
	glutAddMenuEntry("Start", MENU_TIMER_START);
	glutAddMenuEntry("Stop", MENU_TIMER_STOP);

	glutSetMenu(menu_main);
	glutAttachMenu(GLUT_RIGHT_BUTTON);
	////////////////////////////
}
コード例 #3
0
void ProcessMenu(int value)
{
    if (value >= (TOTAL_SHAPES+TOTAL_SHADER_SETS+1))
    {
        char menuEntry[128];
        whichBumpmap = value - TOTAL_SHAPES - TOTAL_SHADER_SETS - 1;
        sprintf(menuEntry, "Choose bumpmap (currently \"%s\")", bumpmapNames[whichBumpmap]);
        glutSetMenu(mainMenu);
        glutChangeToSubMenu(3, menuEntry, bumpmapMenu);
        glBindTexture(GL_TEXTURE_2D, whichBumpmap);
    }
    else if (value >= (TOTAL_SHAPES+1))
    {
        char menuEntry[128];
        whichShader = value - TOTAL_SHAPES - 1;
        sprintf(menuEntry, "Choose shader (currently \"%s\")", shaderNames[whichShader]);
        glutSetMenu(mainMenu);
        glutChangeToSubMenu(2, menuEntry, shaderMenu);
        glUseProgram(progObj[whichShader]);
    }
    else
    {
        char menuEntry[128];
        whichShape = value - 1;
        sprintf(menuEntry, "Choose shape (currently \"%s\")", shapeNames[whichShape]);
        glutSetMenu(mainMenu);
        glutChangeToSubMenu(1, menuEntry, shapeMenu);
    }

    // Refresh the Window
    glutPostRedisplay();
}
コード例 #4
0
ファイル: pulldown.c プロジェクト: AlexGreulich/HRTFVR
/* ARGSUSED2 */
enum muiReturnValue  pdhandler(muiObject *obj, int event, int value, int x, int y)
{
    int i;
    Pulldown *pd = (Pulldown *)obj->object;
 
    if( !muiGetEnable(obj) || !muiGetVisible(obj) ) return MUI_NO_ACTION;
    
    if (event == MUI_DEVICE_UP) {
	for (i = 0; i < pd->count; i++)
	    if (pd->menus[i].xoffset-8 < x && x < pd->menus[i+1].xoffset-8) {
		if (activemenu != pd->menus[i].menu && !menuinuse) {
		    glutSetMenu(activemenu = pd->menus[i].menu);
		    glutAttachMenu(GLUT_LEFT_BUTTON);
		}
		return MUI_NO_ACTION;
	    }
	if (pd->ishelp && (x > pd->helpmenu.xoffset-8)) {
	    if ((activemenu != pd->helpmenu.menu) && !menuinuse) {
		glutSetMenu(activemenu = pd->helpmenu.menu);
		glutAttachMenu(GLUT_LEFT_BUTTON);
	    }
	    return MUI_NO_ACTION;
	}
	if (activemenu && !menuinuse) {
	    glutDetachMenu(GLUT_LEFT_BUTTON);
	    activemenu = -1;
	}
    }
    return MUI_NO_ACTION;
}
コード例 #5
0
ファイル: Menu.cpp プロジェクト: jgollub/MetaImagerProj
void startSubMenu(const char* csName)
{
	int nNewMenuID = glutCreateMenu(mainMenuCallback);
	glutSetMenu(g_MenuBuilder.aMenuPath[g_MenuBuilder.nMenuPathIndex]);
	glutAddSubMenu(csName, nNewMenuID);

	(g_MenuBuilder.nMenuPathIndex)++;
	g_MenuBuilder.aMenuPath[g_MenuBuilder.nMenuPathIndex] = nNewMenuID;
	glutSetMenu(g_MenuBuilder.aMenuPath[g_MenuBuilder.nMenuPathIndex]);
}
コード例 #6
0
ファイル: main.cpp プロジェクト: truenite/truenite-opengl
int addMenu(){
	int mainMenu, subMenu1;
	mainMenu = glutCreateMenu(menu);
	subMenu1 = glutCreateMenu(menu);
	glutSetMenu(mainMenu);
	glutAddSubMenu("Display mode", subMenu1);
	glutSetMenu(subMenu1);
	glutAddMenuEntry("Wireframe",   1);
	glutAddMenuEntry("Solid",     2);
	glutSetMenu(mainMenu);
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
コード例 #7
0
ファイル: main.cpp プロジェクト: tapin13/OpenGL-Lesson-08
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);
}
コード例 #8
0
ファイル: imn428-tp3.cpp プロジェクト: SSTCYR/tp-infographie
int main( int argc, char** argv )
{
    int MenuIdModeler;
    int MenuIdViewer;

	glutInit(&argc, argv);

    glutInitWindowPosition(0, 0);
    glutInitWindowSize( 500, 500);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    windowModelerIndex=glutCreateWindow("Modeler");

    /* Configuration de la couleur de fond (noir) */
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glEnable(GL_DEPTH_TEST);

    /* Creation du menu du modeler */
    MenuIdModeler = glutCreateMenu(menuSelectionModeler);
    glutSetMenu( MenuIdModeler );
    glutAddMenuEntry( "None", ActionNone );
    glutAddMenuEntry( "Sweep", ActionSweep );
    glutAddMenuEntry( "Revolution", ActionRevolution );
    glutAddMenuEntry( "Teapot", ActionTeapot );
    glutAddMenuEntry( "Reset", Reset );
    glutAddMenuEntry( "Quitter", Quit );
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    /* Fonctions de rappel (callback) de glut pour la fenetre 'modeler' */
    glutMouseFunc(mouseButtonModeler);      /* Fonctions appelee lorsqu'un bouton de la souris est enfonce */
    glutMotionFunc(mouseMoveModeler);       /* Fonctions appelee lorsque la souris bouge et qu'un de ses boutons est enfonce */
    glutDisplayFunc(displayModelerWindow);  /* Fonctions appelee lorsque la scene doit etre affichee. */
    glutKeyboardFunc(keyboard);


	/* Double buffer, couleur, avec Z-Buffer */
	glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );

	/* On initialise la fenetre d'une taille raisonnable */
	glutInitWindowPosition(510, 0);
	glutInitWindowSize( 500, 500 );


	/* On cree veritablement la fenetre */
	windowViewerIndex=glutCreateWindow( "IMN428 -- TP3 -- 2010 " );
    glClearColor(0.3, 0.3, 0.3, 1.0);
    glEnable(GL_DEPTH_TEST);

	/* On enregistre les fonctions CALLBACK */
	glutDisplayFunc( displayViewerWindow );
	glutKeyboardFunc( keyboard );
	glutMouseFunc( mouseButtonViewer );
	glutMotionFunc( mouseMoveViewer );

	initGL();

	/* On part le programme jusqu'a ce qu'on quitte */
	glutMainLoop();

	return 0;
}
コード例 #9
0
ファイル: vpaint.c プロジェクト: xtmacbook/SGI
/*ARGSUSED1*/
void
key(unsigned char key, int x, int y)
{
    switch (key) {
    case '\033':
    case 'q':
    case 'Q':
	exit(EXIT_SUCCESS);

    case '+':
	if (maxPoints < 65536 && !useStrokes) {
	    maxPoints *= 2;
	    makepoints();
	}
	break;
    case '-':
	if (maxPoints > 64 && !useStrokes) {
	    maxPoints /= 2;
	    makepoints();
	}
	break;
    case 'e':
    case 'E':
	if (canDrawEdges)
	    drawEdges = !drawEdges;
	break;
    case 'i':
    case 'I':
	viewImage = !viewImage;
	glutChangeToMenuEntry(useStrokes ? 1 : 4, viewImage ? "View artistic image ('i')" : "View source image ('i')", 'i');
	break;
    case 'r':
    case 'R':
	if (!useStrokes)
	    makepoints();
	break;

    case 's':
    case 'S':
	useStrokes = !useStrokes;
	glutSetMenu(useStrokes ? strokeMenu : sampleMenu);
	if (viewImage)
	    glutChangeToMenuEntry(useStrokes ? 1 : 3, "View artistic image ('i')", 'i');

	if (useStrokes) {
	    maxPoints = 65536;
	    free(points);
	    points = (Point *) malloc(maxPoints * sizeof(Point));
	    numPoints = 0;
	} else {
	    maxPoints = 2048;
	    makepoints();
	}
	break;

    default:
	return;
    }
    glutPostRedisplay();
}
コード例 #10
0
ファイル: cube.c プロジェクト: pombredanne/anacrolix
static void initGraphics (void)
{
    /* Black background */
    glClearColor(0, 0, 0, 0);
    /* Wireframe mode */
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

    /* Needed for vertex arrays */
    glEnableClientState(GL_VERTEX_ARRAY);

    /* Popup menu attached to right mouse button */
    AppMenu = glutCreateMenu(menuChoice);
    glutSetMenu(AppMenu);
    glutAddMenuEntry("Red", cmdRed);
    glutAddMenuEntry("Green", cmdGreen);
    glutAddMenuEntry("----", 0);
    glutAddMenuEntry("Reverse", cmdReverse);
    glutAddMenuEntry("----", 0);
    glutAddMenuEntry("Exit", cmdExit);
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    /* Start values */
    Spin = 0.0;
    ViewPoint[0] = 0.0;
    ViewPoint[1] = 0.5;
    ViewPoint[2] = 2.0;

    menuChoice(cmdGreen);
}
コード例 #11
0
ファイル: main.cpp プロジェクト: jzerpa/glbasics04
/*
	main - The Main Function
*/
int main (int argc, char ** argv)
{	
	glutInit(&argc,argv);

	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);

	glutCreateWindow("Practica 4 - José Zerpa");

	/* tells glut to use a particular display function to redraw */
	glutDisplayFunc(display);

	/* allow the user to quit using the right mouse button menu */
	g_iMenuId = glutCreateMenu(menufunc);
	glutSetMenu(g_iMenuId);
	glutAddMenuEntry("Quit",0);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	glutIdleFunc(doIdle);

	/* callback for mouse button changes */
	glutMouseFunc(mousebutton);

	glutReshapeFunc(reshape);

    calcPoints();

	myinit();

	glutMainLoop();
	return 0;
}
コード例 #12
0
ファイル: starter.cpp プロジェクト: rocqetQueen/CPU-RayTracer
/*
	main - The Main Function
*/
int main (int argc, char ** argv)
{
	if (argc < 2)
	{
		printf ("usage: %s scenefile\n", argv[0]);
		exit(1);
	}

	if (!g_RayTrace.m_Scene.Load (argv[1]))
	{
		printf ("failed to load scene\n");
		exit(1);
	}

	printf ("Right-click and choose Render to begin Ray-tracing...\n");

	glutInit(&argc,argv);

	/* create a window */
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowSize(Scene::WINDOW_WIDTH, Scene::WINDOW_HEIGHT);

	glutCreateWindow("Trazador de rayos");

	/* tells glut to use a particular display function to redraw */
	glutDisplayFunc(display);

	/* create a right mouse button menu */
	g_iMenuId = glutCreateMenu(menufunc);
	glutSetMenu(g_iMenuId);
	glutAddMenuEntry("Render Normal",0);
	glutAddMenuEntry("Render Ray Tracing",1);
	glutAddMenuEntry("Render Ray Tracing Supersampling",2);
	glutAddMenuEntry("Render Ray Tracing Monte Carlo",3);
	glutAddMenuEntry("Render Ray Tracing with Depth of Field", 4);
	glutAddMenuEntry("Render Ray Tracing with Soft Shadows", 5);
	glutAddMenuEntry("Quit", 6);
	//glutAddMenuEntry("Quit", 4);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	/* replace with any animate code */
	glutIdleFunc(doIdle);

	/* callback for mouse drags */
	glutMotionFunc(mousedrag);
	/* callback for idle mouse movement */
	glutPassiveMotionFunc(mouseidle);
	/* callback for mouse button changes */
	glutMouseFunc(mousebutton);
	/* callback for keyboard changes */
	glutKeyboardFunc(processkeys);
	/* callback for arrow key changes */
	glutSpecialFunc(processarrowkeys);

	/* do initialization */
	myinit();

	glutMainLoop();
	return 0;
}
コード例 #13
0
	// initialize all the menu functionality
	void init() {

		g_iMenuId = glutCreateMenu(menufunc);
		glutSetMenu(g_iMenuId);
		glutAddMenuEntry("Quit", 0);
		glutAttachMenu(GLUT_RIGHT_BUTTON);
	}
コード例 #14
0
ファイル: Menu.c プロジェクト: SNavleen/Paint
/*Meun GlutInitMenu*/
void Menu::GlutInitMenu(){
    int submenuActionColour = glutCreateMenu(MenuActionColour);
    // TODO Move to different file as an array//
    glutAddMenuEntry("Red", 0);
    glutAddMenuEntry("Blue", 1);
    glutAddMenuEntry("Green", 2);
    glutAddMenuEntry("Purple", 3);
    glutAddMenuEntry("Yellow", 4);
    glutAddMenuEntry("Random Colour", 5);

    int submenuActionShapes = glutCreateMenu(MenuActionShapes);
    // TODO Move to different file as an array//
    glutAddMenuEntry("Point", 0);
    glutAddMenuEntry("Line", 1);
    glutAddMenuEntry("Rectangle", 2);
    glutAddMenuEntry("Circle", 3);

    int menuAction = glutCreateMenu(MenuAction); 
    glutAddSubMenu("Colour", submenuActionColour);
    glutAddSubMenu("Shapes", submenuActionShapes);
    glutAddMenuEntry("Clear", 0);
    glutAddMenuEntry("Quit", 1);

    glutSetMenu(menuAction);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
}
コード例 #15
0
ファイル: Menu.cpp プロジェクト: jgollub/MetaImagerProj
void endSubMenu()
{
	(g_MenuBuilder.nMenuPathIndex)--;
	int nParentMenuID = g_MenuBuilder.aMenuPath[g_MenuBuilder.nMenuPathIndex];

	glutSetMenu(nParentMenuID);
}
コード例 #16
0
void processNormalKeys(unsigned char key, int xx, int yy) {

	glutSetMenu(mainMenu);
	switch (key) {
		case 27:
			glutDestroyMenu(mainMenu);
			glutDestroyMenu(fillMenu);
			glutDestroyMenu(colorMenu);
			glutDestroyMenu(shrinkMenu);
			exit(0);
			break;

		case 's':
			if (!menuFlag)
			  glutChangeToSubMenu(2,"Shrink",shrinkMenu);
			break;
		case 'c':
			if (!menuFlag)
				glutChangeToSubMenu(2,"Color",colorMenu);
			break;
              
	}
	if (key == 27)
		exit(0);
      
}
コード例 #17
0
ファイル: backup4.cpp プロジェクト: anubhavmagic/Blocks-Game
void normalKeyboard(unsigned char key, int xx, int yy)
{

	glutSetMenu(mainMenu);
	switch (key) {
		case 27:
			glutDestroyMenu(mainMenu);
			glutDestroyMenu(fillMenu);
			glutDestroyMenu(colorMenu);
			glutDestroyMenu(shrinkMenu);
			exit(0);
			break;

		case 's':
			if (!menuFlag)
			  glutChangeToSubMenu(2,"Shrink",shrinkMenu);
			break;
		case 'c':
			if (!menuFlag)
				glutChangeToSubMenu(2,"Color",colorMenu);
			break;
	}
	if (key == 27)
        if (glutGameModeGet(GLUT_GAME_MODE_ACTIVE) != 0)
				glutLeaveGameMode();
		exit(0);
}
コード例 #18
0
int main(int argc, char** argv)
{
   int menuA;
   glutInit(&argc, argv);
   glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
   /* add command line argument "classic" for a pre-3.x context */
   if ((argc != 2) || (strcmp (argv[1], "classic") != 0)) {
      glutInitContextVersion (3, 1);
      glutInitContextFlags (GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG);
   }
   glutInitWindowSize (500, 500); 
   glutInitWindowPosition (100, 100);
   glutCreateWindow (argv[0]);
   dumpInfo ();
   init ();
   glutDisplayFunc(display); 
   glutReshapeFunc(reshape);
   glutKeyboardFunc (keyboard);

   /* Add a menu. They have their own context and should thus work with forward compatible main windows too. */
   menuA = glutCreateMenu(samplemenu);
   glutAddMenuEntry("Sub menu A1 (01)",1);
   glutAddMenuEntry("Sub menu A2 (02)",2);
   glutAddMenuEntry("Sub menu A3 (03)",3);
   glutSetMenu(menuA);
   glutAttachMenu(GLUT_RIGHT_BUTTON);

   glutMainLoop();
   return 0;
}
コード例 #19
0
void create_menus() {
	int menu, anim, j;

/*	anim = glutCreateMenu(anim_menu);
	glutAddMenuEntry("Play forward (a)", MENU_ANIM_FORWARD);
	glutAddMenuEntry("Play reverse (b)", MENU_ANIM_REVERSE);
	glutAddMenuEntry("Advance frame (>)", MENU_ANIM_PLUS);
	glutAddMenuEntry("Backstep frame (<)", MENU_ANIM_MINUS);
	glutAddMenuEntry("Re(w)ind", MENU_ANIM_REWIND);
	glutAddMenuEntry("(S)top", MENU_ANIM_STOP);*/

	menu = glutCreateMenu(menu_func);
	for(j = 0; j < sizeof(menu_choices)/sizeof(*menu_choices); j++)
		glutAddMenuEntry(menu_choices[j], MENU_TEXTURE + j);
/*	glutAddSubMenu("Animate...", anim);*/
	glutAddMenuEntry("Quit", MENU_EXIT);
	
	glutSetMenu(menu);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	/* Turn off some menu items */
	menu_func(MENU_WIREFRAME);
        menu_func(MENU_AXES);
	/* menu_func(MENU_GRIDLINES);*/
	menu_func(MENU_SNAPSHOT);
}
コード例 #20
0
ファイル: main.cpp プロジェクト: Jing-Qiu/JelloDemo
void onMouseCb(int button, int state, int x, int y)
{
   theButtonState = button;
   theModifierState = glutGetModifiers();
   lastX = x;
   lastY = y;
   glutSetMenu(theMenu);
}
コード例 #21
0
ファイル: conway.cpp プロジェクト: bickybilly/graphics
void initMenu(){
	int id = glutCreateMenu(menu);
	glutSetMenu(id);
		glutAddMenuEntry("Toggle Cell", 0);
		glutAddMenuEntry("Block", 1);
		glutAddMenuEntry("Blinker", 2);
		glutAddMenuEntry("Glider", 3);
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
コード例 #22
0
ファイル: gemglutwindow.cpp プロジェクト: Jackovic/Gem
void gemglutwindow :: addMenuMess(t_symbol*sym, int argc, t_atom*argv) {
  if (argc!=3)return;
  int menu=atom_getint(argv+0);
  const char*s=atom_getsymbol(argv+1)->s_name;
  int v=atom_getint(argv+2);

  glutSetMenu(menu);
  glutAddMenuEntry(s, v);
}
コード例 #23
0
void 
GlutMenu::detach()
{
	if (_menuID!=-1)
	{
		glutSetMenu(_menuID);
		glutDetachMenu(_button);
	}
}
コード例 #24
0
void 
GlutMenu::addEntry(const std::string &name,GlutMenu &menu)
{
	if (_menuID==-1)
		_menuID = glutCreateMenu(GlutMaster::OnMenu);

	glutSetMenu(_menuID);
	glutAddSubMenu(name.c_str(),menu._menuID);
}
コード例 #25
0
void 
GlutMenu::addEntry(const std::string &name,int value)
{
	if (_menuID==-1)
		_menuID = glutCreateMenu(GlutMaster::OnMenu);

	glutSetMenu(_menuID);
	glutAddMenuEntry(name.c_str(),value);
}
コード例 #26
0
int MakeLoadAndSaveMenus(void)
{
  DIR *dirp = opendir(".");
  struct dirent *direntp;
  int csetnum = 0;
  char *newcsetname;

  if (LoadMenu != -1)
    glutDestroyMenu(LoadMenu);
  if (SaveMenu != -1)
    glutDestroyMenu(SaveMenu);

  SaveMenu = glutCreateMenu(HandleSaveMenu);
  LoadMenu = glutCreateMenu(HandleLoadMenu);

  if (dirp == NULL) {
    fprintf(stderr, "Error opening current dir in MakeLoadAndSaveMenus\n");
    return(0);
  }

  while ((direntp = readdir(dirp)) != NULL) {
    char *ext = direntp->d_name + (strlen(direntp->d_name) - CSET_EXTLEN);
    if (!strcmp(ext, CSET_EXT)) {
      newcsetname = (char*)malloc(strlen(direntp->d_name) - CSET_EXTLEN + 1);
      strncpy(newcsetname, direntp->d_name,
	      strlen(direntp->d_name) - CSET_EXTLEN);
      newcsetname[strlen(direntp->d_name) - CSET_EXTLEN] = 0;
      CSetNames[csetnum] = newcsetname;
      glutAddMenuEntry(newcsetname, csetnum++);
    }
  }
  closedir(dirp);
  glutSetMenu(LoadMenu);
  glutAddMenuEntry("-> Rescan Directory <-", -1);
  glutSetMenu(SaveMenu);
  CSetNames[csetnum] = (char*)"NewCurve0";
  glutAddMenuEntry("NewCurve0", csetnum++);
  CSetNames[csetnum] = (char*)"NewCurve1";
  glutAddMenuEntry("NewCurve1", csetnum++);
  CSetNames[csetnum] = (char*)"NewCurve2";
  glutAddMenuEntry("NewCurve2", csetnum++);

  return (csetnum - 2);  /* just indicate curves in Load menu */
}
コード例 #27
0
ファイル: main.cpp プロジェクト: scallopedllama/coaster
// The ubiquituous main function.
int main ( int argc, char** argv )   // Create Main Function For Bringing It All Together
{
	// get the the filename from the commandline.
	if (argc!=2)
	{
	}


	//initialize glut specific items
	initGlut(argc, argv);

	//initialize openGL specific items
	initGL ();

	// tells glut to use a particular display function to redraw
	glutDisplayFunc(display);

	// allow the user to quit using the right mouse button menu
	// Set menu function callback
	g_iMenuId = glutCreateMenu(menufunc);

	// Set identifier for menu
	glutSetMenu(g_iMenuId);

	// Add quit option to menu
	glutAddMenuEntry("Quit",0);
	glutAddMenuEntry("Take a Snapshot",1);

	// Attach menu to right button clicks
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	// Set idle function.  You can change this to call code for your animation,
	// or place your animation code in doIdle
	glutIdleFunc(doIdle);

	// callback for keyboard input
	glutKeyboardFunc(keyboard);

	// callback for mouse drags
	glutMotionFunc(mousedrag);

	// callback for idle mouse movement
	glutPassiveMotionFunc(mouseidle);

	// callback for mouse button changes
	glutMouseFunc(mousebutton);

	//initialize global variables
	sky.init();

	c.init("track");

	glutMainLoop        ();          // Initialize The Main Loop

	return 0;
}
コード例 #28
0
//инициализация меню
void menuinit()
{
	int m = glutCreateMenu(menu_check);
	glutSetMenu(m);
	glutAddMenuEntry("Квадрат", 0);
	glutAddMenuEntry("Круг", 1);
	glutAddMenuEntry("Прямоугольник", 2);
	glutAddMenuEntry("Инструкции", 3);
	glutAttachMenu(GLUT_RIGHT_BUTTON);//вызов меню с помощью правой кнопки мыши
}
コード例 #29
0
ファイル: rc_main.cpp プロジェクト: jbl5088/psu
// The ubiquituous main function.
int main ( int argc, char** argv )   // Create Main Function For Bringing It All Together
{
	// get the the filename from the commandline.
	/*if (argc!=2)
	{
		printf("usage: %s trackfilname\n", argv[0]);
		system("PAUSE");
		exit(1);
	}*/

	/* load the track, this routine aborts if it fails */
	g_Track.loadSplineFrom("track");



	/*** The following are commands for setting up GL      ***/
	/*** No OpenGl call should be before this sequence!!!! ***/

	/* Initialize glut */
	glutInit(&argc,argv);
	/* Set up window modes */
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	/* Set window position (where it will appear when it opens) */
	glutInitWindowPosition(0,0);
	/* Set size of window */
	glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
	/* Create the window */
	glutCreateWindow    ( "CMPSC 458: Rollercoaster" ); // Window Title (argv[0] for current directory as title)
	/**** Call to our initialization routine****/
	InitGL ();
	/* tells glut to use a particular display function to redraw */
	glutDisplayFunc(display);
	/** allow the user to quit using the right mouse button menu **/
	/* Set menu function callback */
	g_iMenuId = glutCreateMenu(menufunc);
	/* Set identifier for menu */
	glutSetMenu(g_iMenuId);
	/* Add quit option to menu */
	glutAddMenuEntry("Quit",0);
	/* Add any other menu functions you may want here.  The format is:
	* glutAddMenuEntry(MenuEntry, EntryIndex)
	* The index is used in the menufunc to determine what option was selected
	*/
	/* Attach menu to right button clicks */
	glutAttachMenu(GLUT_RIGHT_BUTTON);
	/* Set idle function.  You can change this to call code for your animation,
	* or place your animation code in doIdle */
	glutIdleFunc(doIdle);
	/* callback for keyboard input */
	glutKeyboardFunc(keyboardfunc);

	glutMainLoop        ( );          // Initialize The Main Loop

	return 0;
}
コード例 #30
0
ファイル: main.cpp プロジェクト: azmrv/OpenGL-Game-Pro
void Init() {
    int mainMenu;
    
    mainMenu = glutCreateMenu(Menu);
    
    glutSetMenu(mainMenu);
    glutAddMenuEntry("Exit", 0);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    
    glEnable(GL_DEPTH_TEST);
}