Beispiel #1
0
int main(int argc, char **argv)
{
    int bufferMenu;
    int finishMenu;
    int stenSize;

    glutInitWindowSize(winWidth = 512, winHeight = 512);
    glutInit(&argc, argv);
    glutInitDisplayString("samples stencil>=3 rgb double depth");
    /* glutInitDisplayMode(GLUT_DOUBLE|GLUT_STENCIL|GLUT_DEPTH|GLUT_ALPHA); */
    (void)glutCreateWindow("decaling using stencil");
    glutDisplayFunc(redraw);
    glutKeyboardFunc(keyboard);
    glutMotionFunc(motion);
    glutMouseFunc(button);
    glutReshapeFunc(reshape);

    resizeBuffers();
    glGetIntegerv(GL_STENCIL_BITS, &stenSize);
    fprintf(stderr, "(%d bits of stencil available in this visual)\n", stenSize);

    fprintf(stderr, "Hit 'h' for help message\n");

    finishMenu = glutCreateMenu(changeStage);
    glutAddMenuEntry("Clearing screen", 1);
    glutAddMenuEntry("Drawing airplane", 2);
    glutAddMenuEntry("Drawing ground ", 3);
    glutAddMenuEntry("Drawing asphalt", 4);
    glutAddMenuEntry("Drawing paint", 5);
    glutAddMenuEntry("Drawing shadow", 6);

    bufferMenu = glutCreateMenu(changeData);
    glutAddMenuEntry("Color data", COLOR);
    glutAddMenuEntry("Stencil data", STENCIL);
    glutAddMenuEntry("Depth data", DEPTH);

    mainMenu = glutCreateMenu(stencilDecalEnable);
    glutAddMenuEntry("Turn on stencil decal", 1);
    glutAddSubMenu("Visible buffer", bufferMenu);
    glutAddSubMenu("Finish frame after...", finishMenu);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    init();
    glutMainLoop();

    return 0;
}
Beispiel #2
0
void createMenu(void){
	//animeringsmeny = glutCreateMenu(menu);
	//glutAddMenuEntry("menu 1", 1);
	//glutAddMenuEntry("menu 2", 2);
	
	//springmeny = glutCreateMenu(menu);
	//glutAddMenuEntry("menu 3", 3);
	//glutAddMenuEntry("menu 4", 4);
	
	menyid = glutCreateMenu(menu);
	//glutAddSubMenu("menu 5", animeringsmeny);
	//glutAddSubMenu("menu 6", springmeny);
	glutAddMenuEntry("snapshot", 7);
	glutAddMenuEntry("exit", 0);
	
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #3
0
void setupMenu(void)
{
int numClades,menu,i;
extern Hash subclades;
Entry e;
if (!subclades) return;
menu=glutCreateMenu(handleMenuClicks);
glutAddMenuEntry("Root tree",0);  // 0th menu item is the root tree
numClades = subclades->numElements;
for (i=0;i<numClades;i++)
	{
	e= hashGetKthEntry(subclades,i);
	if (e)
		glutAddMenuEntry(e->key,i+1);// index is a code for which entry; 0 = root tree; 1...n are the subclades
	}
glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #4
0
int main(int argc, char* argv[])
{
    GLint i;

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(windowWidth, windowHeight);
    glutCreateWindow("Procedural Texture Mapping Demo");
    glutReshapeFunc(ChangeSize);
    glutKeyboardFunc(KeyPressFunc);
    glutSpecialFunc(SpecialKeys);
    glutDisplayFunc(RenderScene);

    SetupRC();

    // Create the menus
    shaderMenu = glutCreateMenu(ProcessMenu);
    for (i = 0; i < TOTAL_SHADER_SETS; i++)
    {
        char menuEntry[128];
        sprintf(menuEntry, "\"%s\"", shaderNames[i]);
        glutAddMenuEntry(menuEntry, 1+i);
    }

    mainMenu = glutCreateMenu(ProcessMenu);
    {
        char menuEntry[128];
        sprintf(menuEntry, "Choose fragment shader (currently \"%s\")", shaderNames[0]);
        glutAddSubMenu(menuEntry, shaderMenu);
    }
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    glutMainLoop();

    if (glDeleteProgram && glDeleteShader)
    {
        for (i = 0; i < TOTAL_SHADER_SETS; i++)
        {
            glDeleteProgram(progObj[i]);
            glDeleteShader(vShader[i]);
            glDeleteShader(fShader[i]);
        }
    }

    return 0;
}
Beispiel #5
0
/*
 * Menu creation
 */
void SetUpMenu(void)
{
    int SampleMenu;
    
    SampleMenu = glutCreateMenu(SelectSampleRate);
    glutAddMenuEntry("1", 1);
    glutAddMenuEntry("5", 5);
    glutAddMenuEntry("10", 10);
    glutAddMenuEntry("20", 20);
    glutCreateMenu(MainMenu);
    glutAddMenuEntry("Mouse Motion", 0);
    glutAddMenuEntry("Line antialias", 1);
    glutAddSubMenu("Sample rate", SampleMenu);
    glutAddMenuEntry("Quit", 2);
    glutAttachMenu(GLUT_RIGHT_BUTTON);

}
Beispiel #6
0
void initMenus()
{
    glutCreateMenu(mainMenu);
    glutAddMenuEntry("Reset block [g]", 'g');
    glutAddMenuEntry("Reset random [a]", 'a');
    glutAddMenuEntry("Add sphere [e]", 'e');
    glutAddMenuEntry("Shoot ball [b]", 'b');
    glutAddMenuEntry("View mode [v]", 'v');
    glutAddMenuEntry("Move cursor mode [m]", 'm');
    glutAddMenuEntry("Toggle point rendering [p]", 'p');
	glutAddMenuEntry("Toggle Bullet simulation[s]", 's');
    glutAddMenuEntry("Toggle animation [ ]", ' ');
    glutAddMenuEntry("Step animation [ret]", 13);
    glutAddMenuEntry("Toggle sliders [h]", 'h');
    glutAddMenuEntry("Quit (esc)", '\033');
    glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #7
0
void 
gl_menu_init() 
{
	displayMenu = glutCreateMenu(set_display_type);

	glutAddMenuEntry("Show all (atoms + cell + axes)", SHOWALL);

	glutAddMenuEntry("Atoms only", ATOMSONLY);

	mainMenu = glutCreateMenu(kill_main_window);

	glutAddSubMenu("Display Options", displayMenu);

	glutAddMenuEntry("Exit", 99);

	glutAttachMenu(GLUT_RIGHT_BUTTON); 
}
Beispiel #8
0
int
main(int argc, char **argv)
{
	GLboolean fullscreen = GL_FALSE; 
	GLint time_menu;
 	
 	srand(0);

        glutInit(&argc, argv);
	if (argc > 1 && !strcmp(argv[1], "-w"))
		fullscreen = GL_FALSE;

	//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitDisplayString("rgba double depth=24");
	if (fullscreen) {
	  glutGameModeString("1024x768:32");
	  glutEnterGameMode();
	} else {
	  glutInitWindowSize(320, 240);
	  glutCreateWindow("Atlantis Timing");
	}
    Init();
    glutDisplayFunc(Display);
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    moving = GL_TRUE;
    glutIdleFunc(Animate);
    glutVisibilityFunc(Visible);
    
    time_menu = glutCreateMenu(timingSelect);
    glutAddMenuEntry("GL_VENDOR", 1);
    glutAddMenuEntry("GL_RENDERER", 2);
    glutAddMenuEntry("GL_VERSION", 3);
    glutAddMenuEntry("GL_EXTENSIONS", 4);
    
    glutCreateMenu(menuSelect);
    glutAddMenuEntry("Start motion", 1);
    glutAddMenuEntry("Stop motion", 2);
    glutAddSubMenu("Timing Mode", time_menu);
    glutAddMenuEntry("Quit", 4);
    
    //glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutMainLoop();
    return 0;             /* ANSI C requires main to return int. */
}
void
InitMenus( )
{
    glutSetWindow( MainWindow );

    int numColors = sizeof( Colors ) / ( 3*sizeof(int) );
    int colormenu = glutCreateMenu( DoColorMenu );
    for( int i = 0; i < numColors; i++ )
    {
        glutAddMenuEntry( ColorNames[i], i );
    }

    int axesmenu = glutCreateMenu( DoAxesMenu );
    glutAddMenuEntry( "Off",  0 );
    glutAddMenuEntry( "On",   1 );

    int depthcuemenu = glutCreateMenu( DoDepthMenu );
    glutAddMenuEntry( "Off",  0 );
    glutAddMenuEntry( "On",   1 );

    int debugmenu = glutCreateMenu( DoDebugMenu );
    glutAddMenuEntry( "Off",  0 );
    glutAddMenuEntry( "On",   1 );

    int projmenu = glutCreateMenu( DoProjectMenu );
    glutAddMenuEntry( "Orthographic",  ORTHO );
    glutAddMenuEntry( "Perspective",   PERSP );

    int viewmenu = glutCreateMenu( DoViewMenu );
    glutAddMenuEntry( "Outside",  OUTSIDE );
    glutAddMenuEntry( "Inside",   INSIDE );

    int mainmenu = glutCreateMenu( DoMainMenu );
    glutAddSubMenu(   "Axes",          axesmenu);
    glutAddSubMenu(   "Colors",        colormenu);
    glutAddSubMenu(   "Depth Cue",     depthcuemenu);
    glutAddSubMenu(   "Projection",    projmenu );
    glutAddSubMenu(   "View",          viewmenu );
    glutAddMenuEntry( "Reset",         RESET );
    glutAddSubMenu(   "Debug",         debugmenu);
    glutAddMenuEntry( "Quit",          QUIT );

// attach the pop-up menu to the right mouse button:

    glutAttachMenu( GLUT_RIGHT_BUTTON );
}
Beispiel #10
0
void
main(int argc, char **argv)
{
  int i, mode = GLUT_DOUBLE;

  glutInit(&argc, argv);

  for (i = 1; i < argc; i++) {
    if (!strcmp(argv[i], "-no3Dtex")) {
      tex3dSupported = 0;
    } else if (!strcmp(argv[i], "-sb")) {
      mode = GLUT_SINGLE;
    }
  }

  /* let glut do all the X Stuff */
  glutInitDisplayMode(GLUT_RGB | mode);
  glutCreateWindow("Voxel Head");

  /* init our variables, etc */
  init();

  /* read texture data from a file */
  readVoxelData();

  /* set up OpenGL texturing */
  if (tex3dSupported)
    load3DTexture();

  /* register specific routines to glut */
  glutDisplayFunc(drawScene);
  glutReshapeFunc(resize);
  glutKeyboardFunc(keyboard);

  /* create popup menu for glut */
  glutCreateMenu(menu);

  glutAddMenuEntry("Random Spin ON", SPIN_ON);
  glutAddMenuEntry("Help", MENU_HELP);
  glutAddMenuEntry("Exit", MENU_EXIT);

  glutAttachMenu(GLUT_RIGHT_BUTTON);

  /* loop for ever */
  glutMainLoop();
}
/**
 * Terrain generation demonstration!
 * @param argc Ignored.
 * @param argv Ignored.
 * @return EXIT_SUCCESS.
 */
int main( int argc, char **argv ) {

    Engine::init( &argc, argv, "Terrain Generation Flythrough" );
    Engine::instance()->registerIdle( terrain_idle );
    init();

    int menu = glutCreateMenu( menufunc );
    glutSetMenu( menu );
    glutAddMenuEntry( "Randomize Terrain", 0 );
    glutAddMenuEntry( "Toggle Free Rotation", 1 );
    glutAttachMenu( GLUT_RIGHT_BUTTON );

    /* PULL THE TRIGGER */
    Engine::run();
    return EXIT_SUCCESS;

}
Beispiel #12
0
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Scene constructor - initalize any values and register GLUI callbacks
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Scene::Scene(){
    rubberbanding = false;
    rbStartX = 0;
    rbStartY = 0;

	GLUI_Master.set_glutDisplayFunc( redraw_cb );   // register redraw function
    glutCreateMenu( processRightButtonMenu_cb );
    glutAddMenuEntry( "Clear scene", CLEAR_CMD );
    glutAddMenuEntry( "Exit", EXIT_CMD );
    //attach current menu to a right-click
    glutAttachMenu( GLUT_RIGHT_BUTTON );

    // Default Values
    current_shape = newX = newY = 0;
    borderColor   = fillColor = new Color(1,0,0);
    drawBoundary  = drawFill = true;
}
Beispiel #13
0
//--Main
int main(int argc, char **argv)
{
    // Initialize glut
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(w, h);

    // Name and create the Window
    glutCreateWindow("Rotating Cube");

    // Now that the window is created the GL context is fully set up
    // Because of that we can now initialize GLEW to prepare work with shaders
    GLenum status = glewInit();
    if( status != GLEW_OK)
    {
        std::cerr << "[F] GLEW NOT INITIALIZED: ";
        std::cerr << glewGetErrorString(status) << std::endl;
        return -1;
    }

    // Create menu
    glutCreateMenu(menu); // Call menu function
    glutAddMenuEntry("Quit", 1);
    glutAddMenuEntry("Start rotation", 2);
    glutAddMenuEntry("Stop rotation", 3);
    glutAttachMenu(GLUT_RIGHT_BUTTON); //Called if there is a mouse click (right)

    // Set all of the callbacks to GLUT that we need
    glutDisplayFunc(render);// Called when its time to display
    glutReshapeFunc(reshape);// Called if the window is resized
    glutIdleFunc(update);// Called if there is nothing else to do
    glutKeyboardFunc(keyboard);// Called if there is keyboard input
    glutMouseFunc(mouse);// Called if there is a mouse click (left)

    // Initialize all of our resources(shaders, geometry)
    bool init = initialize();
    if(init)
    {
        t1 = std::chrono::high_resolution_clock::now();
        glutMainLoop();
    }

    // Clean up after ourselves
    cleanUp();
    return 0;
}
Beispiel #14
0
int main (int argc, char ** argv)
{

	//You will be creating a menu to load in scenes
	//The test.xml is the default scene and you will modify this code
	if (!g_RayTrace.m_Scene.Load (xmlFile))
	{
		printf ("failed to load scene\n");
		exit(1);
	}

	glutInit(&argc,argv);

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

	glutCreateWindow("Assignment 5 - Ray Tracer");

	/* 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 RayTrace",0);
	glutAddMenuEntry("Render Normal",1);
	glutAddMenuEntry("Scene 1",3);
	glutAddMenuEntry("Scene 2",4);
	glutAddMenuEntry("Scene 3",5);
	glutAddMenuEntry("Quit",2);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

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

	/* callback for idle function */
	glutIdleFunc(doIdle);

	/* do initialization */
	myinit();

	glutMainLoop();
	return 0;
}
Beispiel #15
0
int main(int argc, char **argv)
{
	Server::getInstance();

    unsigned int i;

    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_DEPTH|GLUT_DOUBLE );
    main_window = glutCreateWindow( "OpenGL Remote Rendering Server" );
    glutDisplayFunc( cb_display );
    glutReshapeFunc( cb_reshape );
    glutIdleFunc( cb_idle );

    glutCreateMenu( cb_menu );
    for( i = 0; i < NUMBEROF( font_map ); ++i )
        glutAddMenuEntry( font_map [ i ].name, i );
    glutAddMenuEntry( "Quit", i );
    glutAttachMenu( 2 );

	font = GLUT_BITMAP_HELVETICA_12; //GLUT_BITMAP_8_BY_13;

    printf("glut window id: %d\n", glutGetWindow());

	/* ffmpeg init */
	width = glutGet(GLUT_WINDOW_WIDTH);
	height = glutGet(GLUT_WINDOW_HEIGHT);
	ffmpeg = fopen("output.h264", "wb");

	encoder = new Encoder();
	if (!encoder->bootstrap(AV_CODEC_ID_H264, width, height, 25)) //MPEG1VIDEO
		exit(EXIT_FAILURE);
	buffer = new uint8_t[3*width*height];

    for (;;)
    {
        glutPostRedisplay();
        glutMainLoopEvent();
    }

	encoder->writeEndFile(ffmpeg);
	fclose(ffmpeg);
	delete[] buffer;

    return EXIT_SUCCESS;
}
Beispiel #16
0
int main(int argc, char* argv[])
{
    GLint i;

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(windowWidth, windowHeight);
    glutCreateWindow("Vertex Blending Demo");
    glutReshapeFunc(ChangeSize);
    glutKeyboardFunc(KeyPressFunc);
    glutSpecialFunc(SpecialKeys);
    glutDisplayFunc(RenderScene);

    SetupRC();

    // Create the menus
    mainMenu = glutCreateMenu(ProcessMenu);
    glutAddMenuEntry("Toggle vertex blending (currently ON)", 1);
    glutAddMenuEntry("Show bones (currently OFF)", 2);
    if (lowLevelAvailable && highLevelAvailable)
    {
        if (useHighLevel)
        {
            glutAddMenuEntry("Switch to low-level vertex shader", 3);
        }
        else
        {
            glutAddMenuEntry("Switch to high-level vertex shader", 3);
        }
    }
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    glutMainLoop();

    if (glDeleteObjectARB)
    {
        for (i = 0; i < TOTAL_SHADERS; i++)
        {
            glDeleteObjectARB(progObj[i]);
            glDeleteObjectARB(vShader[i]);
        }
    }

    return 0;
}
Beispiel #17
0
/**
*** criação de menu
**/
void criaMenu() {
	///int principal;
	int gerenciarDificuldade;

    /// menu de dificuldade
	gerenciarDificuldade = glutCreateMenu(menuDificuldade);
	glutAddMenuEntry("Aumentar", 0);
	glutAddMenuEntry("Diminuir", 1);

    /// menu principal
	///principal = glutCreateMenu(menuPrincipal);
	glutCreateMenu(menuPrincipal);
	glutAddSubMenu("Dificuldade", gerenciarDificuldade);
	///glutAddMenuEntry("Full Screen", 1);
	glutAddMenuEntry("Sair", 0);

	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #18
0
void createGLUTMenus() {

	int menu;

	// create the menu and
	// tell glut that "processMenuEvents" will
	// handle the events
	menu = glutCreateMenu(processMenuEvents);

	//add entries to our menu
	glutAddMenuEntry("SAVE",RED);
	glutAddMenuEntry("Undo",BLUE);
	glutAddMenuEntry("Green",GREEN);
	glutAddMenuEntry("Orange",ORANGE);

	// attach the menu to the right button
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #19
0
// the main function
int main(int argc, char** argv) {

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(winWidth, winHeight);
	glutCreateWindow("A2 (Written by Dallas Fraser)");
	init();
	menu();

	glutDisplayFunc(display);
	glutMotionFunc(mouseMotion);
	glutMouseFunc(mouseAction);
	glutAttachMenu(GLUT_RIGHT_BUTTON);
	glutMainLoop();

	return 0;
}
Beispiel #20
0
static void initApp ()
{
printf("initApp \n");
  initGraphics();
  initShaders();
  /* Make sure we did everything right */
  CheckGL();
  chooseShader(0);
  
   Menu = glutCreateMenu(menuChoice);
  glutSetMenu(Menu);
  glutAddMenuEntry("Fragment shader", cmdToggleFragment);
  glutAddMenuEntry("Sphere", cmdSphere);
  glutAddMenuEntry("Teapot", cmdTeapot);
  glutAddMenuEntry("----", 0);
  glutAddMenuEntry("Exit", cmdExit);
  glutAttachMenu(GLUT_RIGHT_BUTTON);  
}
Beispiel #21
0
void createGLUTMenus() {

   

	// create the menu and
	// tell glut that "processMenuEvents" will
	// handle the events
	glutCreateMenu(processMenuEvents);

	//add entries to our menu
	glutAddMenuEntry("Start",1);
	glutAddMenuEntry("Stop",2);
	glutAddMenuEntry("Exit",3);


	// attach the menu to the right button
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #22
0
void GuyMenuInit(void)
{
  int sub2, sub1 = glutCreateMenu(agvSwitchMoveMode);
  glutAddMenuEntry("Flying move",  FLYING);
  glutAddMenuEntry("Polar move",   POLAR);
  sub2 = glutCreateMenu(GuyModelHandleMenu);
  glutAddMenuEntry("Wire cubes",  WIRECUBE);
  glutAddMenuEntry("Solid cubes", SOLIDCUBE);
  glutAddMenuEntry("Cylinder 1",  CYLINDER1);
  glutAddMenuEntry("Cylinder 2",  CYLINDER2);
  glutCreateMenu(GuyHandleMenu);
  glutAddSubMenu("Viewing", sub1);
  glutAddSubMenu("Model", sub2);
  glutAddMenuEntry("Toggle Axes",    GMENU_AXES);
  glutAddMenuEntry("Toggle Perspective View", GMENU_PERSP);
  glutAddMenuEntry("Quit",           GMENU_QUIT);
  glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #23
0
int
main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
  glutCreateWindow("dinoball (Spaceball demo)");
  glutDisplayFunc(redraw);
  glutMouseFunc(mouse);
  glutMotionFunc(motion);
  glutTabletMotionFunc(tablet);
  glutSpaceballMotionFunc(translate);
  glutSpaceballRotateFunc(rotate);
  glutSpaceballButtonFunc(button);
  glutDialsFunc(dials);
  glutCreateMenu(controlLights);
  glutAddMenuEntry("Toggle right light", 1);
  glutAddMenuEntry("Toggle left light", 2);
  glutAttachMenu(GLUT_RIGHT_BUTTON);
  makeDinosaur();
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHTING);
  glMatrixMode(GL_PROJECTION);
  gluPerspective( /* field of view in degree */ 40.0,
  /* aspect ratio */ 1.0,
    /* Z near */ 1.0, /* Z far */ 100.0);
  glMatrixMode(GL_MODELVIEW);
  gluLookAt(0.0, 0.0, 30.0,  /* eye is at (0,0,30) */
    0.0, 0.0, 0.0,      /* center is at (0,0,0) */
    0.0, 1.0, 0.);      /* up is in positive Y direction */
  glPushMatrix();       /* dummy push so we can pop on model
                           recalc */
  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
  glLightfv(GL_LIGHT0, GL_POSITION, lightZeroPosition);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor);
  glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1);
  glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05);
  glLightfv(GL_LIGHT1, GL_POSITION, lightOnePosition);
  glLightfv(GL_LIGHT1, GL_DIFFUSE, lightOneColor);
  glEnable(GL_LIGHT0);
  glEnable(GL_LIGHT1);
  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
Beispiel #24
0
/*******************************************************************************
 Main function
*******************************************************************************/
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

    glutInitWindowSize(500, 500);

    glutCreateWindow("Point Manipulation Example");

    /* Set glut callback functions. */
    glutDisplayFunc(glutDisplay);
    glutReshapeFunc(glutReshape);
    glutIdleFunc(glutIdle);
    glutMouseFunc(glutMouse);
    glutMotionFunc(glutMotion);
    
    glutCreateMenu(glutMenu);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutAddMenuEntry("Free Manipulation",
                     IHapticDeviceManager::FREE_MANIPULATION);
    glutAddMenuEntry("Spring Manipulation",
                     IHapticDeviceManager::SPRING_MANIPULATION);
    glutAddMenuEntry("Friction Manipulation",
                     IHapticDeviceManager::FRICTION_MANIPULATION);    
    glutAddMenuEntry("Plane Manipulation",
                     IHapticDeviceManager::PLANE_MANIPULATION);
    glutAddMenuEntry("Quit", 5);

    /* The GLUT main loop won't return control, so we need to perform cleanup
       using an exit handler. */
    atexit(exitHandler);

    initScene();

    std::cout << "This example demonstrates point snapping \
and manipulation." << std::endl;
    std::cout << "Use the right mouse button to select \
different manipulation styles." << std::endl;

    glutMainLoop();

    return 0;
}
void createMenu()
{
	GLint volumeRenderingMenuID, thresholdMenuID, transformationMenuID;

	volumeRenderingMenuID = glutCreateMenu(volumeRenderingMenu);
		glutAddMenuEntry("Naive Volume Rendering", 0);
		glutAddMenuEntry("Transfer Function", 1);
		glutAddMenuEntry("Local Illumination", 2);
		glutAddMenuEntry("Non Polygonal Iso Surface Rendering", 3);
		glutAddMenuEntry("Context-Preserving Volume Rendering", 4);
		glutAddMenuEntry("Focus + Context Visualization", 5);
		glutAddMenuEntry("Stochastic Jithering [On/Off]", 6);
		glutAddMenuEntry("Tricubic Interpolation [On/Off]", 7);
		glutAddMenuEntry("MIP [On/Off]", 8);
		glutAddMenuEntry("Gradient by Forward Differences [On/Off]", 9);
		glutAddMenuEntry("Occlusion Based on Clipping [On/Off]", 10);
		glutAddMenuEntry("Invert Clipping [On/Off]", 11);
		
	thresholdMenuID = glutCreateMenu(thresholdMenu);
		glutAddMenuEntry("Change Early Ray Termination", 0);
		glutAddMenuEntry("Change Step Size (Raycasting)", 1);
		glutAddMenuEntry("Change Iso Surface", 2);
		glutAddMenuEntry("Change Ks (Context-Preserving VR)", 3);
		glutAddMenuEntry("Change Kt (Context-Preserving VR)", 4);
		glutAddMenuEntry("Change Clipping Plane Right X", 5); //inverted (also in specialKeyboard)
		glutAddMenuEntry("Change Clipping Plane Left X", 6); //inverted (also in specialKeyboard)
		glutAddMenuEntry("Change Clipping Plane Up Y", 7);
		glutAddMenuEntry("Change Clipping Plane Down Y", 8);
		glutAddMenuEntry("Change Clipping Plane Front Z", 9);
		glutAddMenuEntry("Change Clipping Plane Back Z", 10);
		glutAddMenuEntry("Change Focus Radius", 11);
	
	transformationMenuID = glutCreateMenu(transformationMenu);
		glutAddMenuEntry("Change Translation", 0);
		glutAddMenuEntry("Change Rotation", 1);
		glutAddMenuEntry("Automatic Rotation", 2);

	glutCreateMenu(mainMenu);
		glutAddSubMenu("Transformation", transformationMenuID);
		glutAddSubMenu("Volume Rendering", volumeRenderingMenuID);
		glutAddSubMenu("Threshold", thresholdMenuID);
		glutAttachMenu(GLUT_RIGHT_BUTTON);

}
Beispiel #26
0
int
main(int argc, char *argv[])
{
  int mainMenu, redMenu, greenMenu, blueMenu;

  glutInitWindowSize(680, 440);
  glutInit(&argc, argv);
  splatConfig = splatDefault;

  glutCreateWindow("splatlogo");

  glutReshapeFunc(reshape);
  glutDisplayFunc(display);
  glutMouseFunc(mouse);

  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  glAlphaFunc(GL_GEQUAL, 0.5);
  glDisable(GL_ALPHA_TEST);
  glEnable(GL_DITHER);
  glClearColor(1.0, 1.0, 1.0, 0.0);

  redMenu = glutScaleBiasMenu(0 << 4);
  greenMenu = glutScaleBiasMenu(1 << 4);
  blueMenu = glutScaleBiasMenu(2 << 4);

  mainMenu = glutCreateMenu(mainSelect);
  glutAddMenuEntry("Reset splays", 0);
  glutAddMenuEntry("Reset splat config", 1);
  glutAddSubMenu("Red control", redMenu);
  glutAddSubMenu("Green control", greenMenu);
  glutAddSubMenu("Blue control", blueMenu);
  glutAddMenuEntry("+25% zoom", 2);
  glutAddMenuEntry("-25% zoom", 3);
  glutAddMenuEntry("X flip", 4);
  glutAddMenuEntry("Y flip", 5);
  glutAddMenuEntry("Enable alpha test", 6);
  glutAddMenuEntry("Disable alpha test", 7);
  glutSetMenu(mainMenu);
  glutAddMenuEntry("Query raster position", 411);
  glutAddMenuEntry("Quit", 666);
  glutAttachMenu(GLUT_RIGHT_BUTTON);
  glutMainLoop();
  return 0; /* Never reached; make ANSI C happy. */
}
Beispiel #27
0
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutCreateWindow("Zadanie 3");

	Init();

	glutCreateMenu(Menu);
	glutAddMenuEntry("GL_LINEAR", SWITCH_TO_LINEAR);
	glutAddMenuEntry("GL_NEAREST", SWITCH_TO_NEAREST);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	glutDisplayFunc(Display);

	glutMainLoop();

	return 0;
}
//////////////////////////////////////////////////////
// Program entry point
int main(int argc, char *argv[])
    {
    gltSetWorkingDirectory(argv[0]);

    // Standard initialization stuff
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(800, 600);
    glutCreateWindow("Anisotropic Tunnel");
    glutReshapeFunc(ChangeSize);
    glutSpecialFunc(SpecialKeys);
    glutDisplayFunc(RenderScene);
    
#ifdef ANGLE
	glutKeyboardFunc(KeyPressFunc);
#else
    // Add menu entries to change filter
    glutCreateMenu(ProcessMenu);
    glutAddMenuEntry("GL_NEAREST",0);
    glutAddMenuEntry("GL_LINEAR",1);
    glutAddMenuEntry("GL_NEAREST_MIPMAP_NEAREST",2);
    glutAddMenuEntry("GL_NEAREST_MIPMAP_LINEAR", 3);
    glutAddMenuEntry("GL_LINEAR_MIPMAP_NEAREST", 4);
    glutAddMenuEntry("GL_LINEAR_MIPMAP_LINEAR", 5);
    glutAddMenuEntry("Anisotropic Filter", 6);
    glutAddMenuEntry("Anisotropic Off", 7);

    glutAttachMenu(GLUT_RIGHT_BUTTON);
    
    GLenum err = glewInit();
    if (GLEW_OK != err) {
        fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
        return 1;
    }
#endif 
    
    // Startup, loop, shutdown
    SetupRC();
    glutMainLoop();
    ShutdownRC();
    
    return 0;
    }
Beispiel #29
0
void init()
{
    glEnable(GL_DEPTH_TEST);
    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE);
    glEnable(GL_LIGHTING);
	GLfloat globalAmbient[ ] = { 1.00, 1.00, 1.00, 0.0 };
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient);
    glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE, mat_ambient_diffuse);
    glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
    glMaterialf(GL_FRONT,GL_SHININESS,mat_shininess);

    glClearColor(0.0,0.0,0.0,0.0);

	glutCreateMenu(menu);
    glutAddMenuEntry("pause/unpause (p)", 1);
    glutAddMenuEntry("restart game (r)", 2);
    glutAddMenuEntry("quit", 0);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Beispiel #30
0
void createPopupMenus() {

    fontMenu = glutCreateMenu(processFontMenu);

	//glutAddMenuEntry("BITMAP_8_BY_13 ",INT_GLUT_BITMAP_8_BY_13 );
	//glutAddMenuEntry("BITMAP_9_BY_15",INT_GLUT_BITMAP_9_BY_15 );
	//glutAddMenuEntry("BITMAP_TIMES_ROMAN_10 ",INT_GLUT_BITMAP_TIMES_ROMAN_10  );
	//glutAddMenuEntry("BITMAP_TIMES_ROMAN_24",INT_GLUT_BITMAP_TIMES_ROMAN_24  );
	//glutAddMenuEntry("BITMAP_HELVETICA_10 ",INT_GLUT_BITMAP_HELVETICA_10  );
	//glutAddMenuEntry("BITMAP_HELVETICA_12",INT_GLUT_BITMAP_HELVETICA_12  );
	//glutAddMenuEntry("BITMAP_HELVETICA_18",INT_GLUT_BITMAP_HELVETICA_18 );

	glutAddMenuEntry("STROKE_ROMAN",1 );
    glutAddMenuEntry("STROKE_MONO_ROMAN",2 );

	shrinkMenu = glutCreateMenu(processShrinkMenu);

	glutAddMenuEntry("Shrink",SHRINK);
	glutAddMenuEntry("Normal",NORMAL);

	fillMenu = glutCreateMenu(processFillMenu);

	glutAddMenuEntry("Fill",FILL);
	glutAddMenuEntry("Line",LINE);

	colorMenu = glutCreateMenu(processColorMenu);
	glutAddMenuEntry("Red",RED);
	glutAddMenuEntry("Blue",BLUE);
	glutAddMenuEntry("Green",GREEN);
	glutAddMenuEntry("Orange",ORANGE);

	mainMenu = glutCreateMenu(processMainMenu);

	glutAddSubMenu("Polygon Mode", fillMenu);
	glutAddSubMenu("Color", colorMenu);
	glutAddSubMenu("Scale", shrinkMenu);
	glutAddSubMenu("Font", fontMenu);
	// attach the menu to the right button
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	// this will allow us to know if the menu is active
	glutMenuStatusFunc(processMenuStatus);
}