int main (int argc, char ** argv) { // main function
    if (argc<2) {
        printf ("usage: %s <trackfile>\n", argv[0]);
        exit(0);
    }

    loadSplines(argv[1]); // load up the splines

    // used to get the second spline, offset it to get two tracks
    for (int i=0; i<g_Splines[1].numControlPoints; i++) { // load up the second spline
        double x_offset = g_Splines[1].points[i].x;
        double y_offset = g_Splines[1].points[i].y;
        double z_offset = g_Splines[1].points[i].z;
        double normal = sqrt(pow(x_offset,2)+pow(y_offset,2)+pow(z_offset,2)); // normalize
        x_offset = x_offset/normal*-1.1; // to offset
        y_offset = y_offset/normal*-1.1;
        z_offset = z_offset/normal*-1.1;
        g_Splines[1].points[i].x = g_Splines[0].points[i].x + x_offset; // offset slightly from the original track
        g_Splines[1].points[i].y = g_Splines[0].points[i].y + y_offset;
        g_Splines[1].points[i].z = g_Splines[0].points[i].z + z_offset;
    }

    glutInit(&argc,argv);

    glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE);
    glutInitWindowPosition(200,200); // window position on screen at 200,200
    glutInitWindowSize(640, 480); // window size is 640x480
    glutCreateWindow("CSCI480 Assignment 2 - Jeremy Chen"); // window title

    glutDisplayFunc(display);

    g_iMenuId = glutCreateMenu(menu); // create menu
    glutSetMenu(g_iMenuId);
    glutAddMenuEntry("Quit", 0);
    glutAddMenuEntry("Restart",1);
    glutAttachMenu(GLUT_RIGHT_BUTTON); // use right-button to get menu

    glutIdleFunc(doIdle);

    myinit();

    glutMainLoop();
}
Example #2
0
int main(int argc, char** argv) {
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowSize(500,500);
    glutInitWindowPosition(0,0);
    glutCreateWindow("Flood Fill algorithm");

    printf("**** Welcome to illustration of line clipping flood fill algorithm: *****\n");
    printf("Window Height : 500 width : 500\n");

    printf("Enter Coordinates of upper-left and bottom-right vertices for required rectangle\n");
    scanf("%d%d%d%d",&a,&b,&c,&d);


    myinit();
    glutDisplayFunc(display);
    glutMainLoop();
    return 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 ("test.xml"))
	{
		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("Quit",2);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	/* callback for mouse button changes */
	glutMouseFunc(mousebutton);
	glutSpecialFunc(navigationkeys);
	/* callback for idle function */
	glutIdleFunc(doIdle);
	glutKeyboardFunc(keys);
	/* do initialization */
	myinit();

	glutMainLoop();
	return 0;
}
Example #4
0
int main(int argc, char **argv)
{
    int s_menu;

    //If argument count < 2 or if the second argument is < 0 set defaults
    if(argc <  2 || atoi(argv[1])<0 || atoi(argv[1])>9)
    {
        n = 0;
        orig = 0;
    }
    else //otherwise take input from the command line
    {
        n=atoi(argv[1]);
        orig = atoi(argv[1]); // keep the orginal so that 'o' can be used to go back
        // to the original input if desired
    }
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(500, 500);
    glutCreateWindow("Koch Snowflake");
    glutDisplayFunc(display);
    myinit();

    //Submenu
    s_menu = glutCreateMenu(spin_menu);
    glutAddMenuEntry("Start",0);
    glutAddMenuEntry("Stop",1);

    //Menu
    glutCreateMenu(main_menu);
    glutAddMenuEntry("Clear Screen", 0);
    glutAddMenuEntry("Redraw Snowflakes", 1);
    glutAddSubMenu("Spin", s_menu);
    glutAddMenuEntry("Quit", 4);
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    glutMouseFunc(myMouse); //Mouse events
    glutKeyboardFunc(myKey); //Keyboard events
    glutSpecialFunc(specialKeys); //Special keyboard events
    glutReshapeFunc(myreshape); //Window reshape events
    glutMainLoop();
}
Example #5
0
int main(int argc, char** argv) 
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowPosition (0, 0);
    glutInitWindowSize(Width,Height);
    glutCreateWindow(argv[0]);
    printf("GL version %s\n", glGetString(GL_VERSION));
    glewExperimental = GL_TRUE;
    glewInit();
    myinit();
    glutReshapeFunc (myReshape);
    glutKeyboardFunc( myKey );
    instructions();
    glutDisplayFunc(display);
    glutIdleFunc(myIdle);
    glutMainLoop();
    TM.Reset() ;
    return 0;         // never reached
}
Example #6
0
/*  Main Loop
 *  Open window with initial window size, title bar,
 *  RGBA display mode, depth buffer, and handle input events.
 */
int
main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(450, 150);
    glutCreateWindow(argv[0]);
    myinit();
    glutReshapeFunc(myReshape);
    glutDisplayFunc(display);
    glutCreateMenu(selectFog);
    glutAddMenuEntry("Fog EXP", GL_EXP);
    glutAddMenuEntry("Fog EXP2", GL_EXP2);
    glutAddMenuEntry("Fog LINEAR", GL_LINEAR);
    glutAddMenuEntry("Quit", 0);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutKeyboardFunc(key);
    glutMainLoop();
    return 0;             /* ANSI C requires main to return int. */
}
Example #7
0
int main(int argc, char**argv)
{

	Read_Information();
	Setup_Parameters();
	RayTraceUtil();

/* Standard GLUT initialization */

    glutInit(&argc,argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); /* default, not needed */
    glutInitWindowSize(500,500); /* 500 x 500 pixel window */
    glutInitWindowPosition(0,0); /* place window top left on display */
    glutCreateWindow("Ray Trace"); /* window title */
    glutDisplayFunc(display); /* display callback invoked when window opened */

    myinit(); /* set attributes */
    glutMainLoop(); /* enter event loop */

	return(0);
}
Example #8
0
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(1366, 750);
    glutInitWindowPosition(0, 0);
    glutCreateWindow("Window");
    myinit();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
    glutKeyboardUpFunc(keyboardUp);
    glutSpecialFunc(special);
    glutSpecialUpFunc(specialUp);
    glutMouseFunc(mouse);
    glutCreateMenu(menu);
    glutAddMenuEntry("Quit", 0);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutIdleFunc(idle);
    glutMainLoop();
}
Example #9
0
/* Main Loop */
int
main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
    glutCreateWindow(argv[0]);
    myinit();
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);
    glutCreateMenu(menu);
    glutAddMenuEntry("Show control points", 1);
    glutAddMenuEntry("Hide control points", 0);
    glutAddMenuEntry("Solid", 2);
    glutAddMenuEntry("Wireframe", 3);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutMouseFunc(mouse);
    glutMotionFunc(motion);
    glutKeyboardFunc(key);
    glutMainLoop();
    return 0;             /* ANSI C requires main to return int. */
}
Example #10
0
int main(int argc, char *argv[])
{
	int sz;
	
        glutInit(&argc,argv);
	sz = (argc > 1) ? atoi(argv[1]) : 200;

	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowPosition(200, 100);
	glutInitWindowSize(sz*1.33*3, sz*3);
	glutCreateWindow("XL Demo");
	glutDisplayFunc(display);
	glutKeyboardFunc(parsekey);
	glutSpecialFunc(parsekey_special);
	glutReshapeFunc(myReshape);
	glutIdleFunc(Animate);
	
	myinit();
	glutSwapBuffers();
	glutMainLoop();
}
Example #11
0
int main(int argc, char *argv[])
{
#ifdef STEREO
	glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE | GLUT_STEREO | GLUT_MULTISAMPLE);
#else
	glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE);
#endif
	glutInitWindowPosition(200, 0);
	glutInitWindowSize(640, 480);
	glutCreateWindow("Rotating OpenGL Logo");
	glutDisplayFunc(display);
	glutKeyboardFunc(parsekey);
	glutSpecialFunc(parsekey_special);
	glutReshapeFunc(myReshape);
	glutIdleFunc(Animate);
	randomize();
	myinit();
	glutSwapBuffers();
	glutMainLoop();
	return 0;             /* ANSI C requires main to return int. */
}
Example #12
0
int main(int argc, char *argv[])
{
    int numFontFiles;

    if((argc >= 2) && !IGNORE_ARGV)
    {
        fontfiles = (char const * const *)argv + 1;
        numFontFiles = argc - 1;
    }
    else
    {
        fontfiles = defaultFonts;
        numFontFiles = NumDefaultFonts;
    }

    if(!fontfiles[0])
    {
        fprintf(stderr, "At least one font file must be specified on the command line\n");
        exit(1);
    }

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE);
    glutInitWindowPosition(50, 50);
    glutInitWindowSize(w_win, h_win);
    glutCreateWindow("FTGL TEST");
    glutDisplayFunc(display);
    glutKeyboardFunc(parsekey);
    glutSpecialFunc(parseSpecialKey);
    glutMouseFunc(mouse);
    glutMotionFunc(motion);
    glutReshapeFunc(myReshape);
    glutIdleFunc(display);

    myinit(numFontFiles);

    glutMainLoop();

    return 0;
}
int main(int argc, char** argv)
{
    int c_menu, p_menu, f_menu;

    glutInit(&argc,argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(500, 500);
    glutCreateWindow("square");
    glutDisplayFunc(display);
    c_menu = glutCreateMenu(color_menu);
    glutAddMenuEntry("Red",1);
    glutAddMenuEntry("Green",2);
    glutAddMenuEntry("Blue",3);
    glutAddMenuEntry("Cyan",4);
    glutAddMenuEntry("Magenta",5);
    glutAddMenuEntry("Yellow",6);
    glutAddMenuEntry("White",7);
    glutAddMenuEntry("Black",8);
    p_menu = glutCreateMenu(pixel_menu);
    glutAddMenuEntry("increase pixel size", 1);
    glutAddMenuEntry("decrease pixel size", 2);
    f_menu = glutCreateMenu(fill_menu);
    glutAddMenuEntry("fill on", 1);
    glutAddMenuEntry("fill off", 2);
    glutCreateMenu(right_menu);
    glutAddMenuEntry("quit",1);
    glutAddMenuEntry("clear",2);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutCreateMenu(middle_menu);
    glutAddSubMenu("Colors", c_menu);
    glutAddSubMenu("Pixel Size", p_menu);
    glutAddSubMenu("Fill", f_menu);
    glutAttachMenu(GLUT_MIDDLE_BUTTON);
    myinit ();
    glutReshapeFunc (myReshape); 
	glutKeyboardFunc(key);
    glutMouseFunc (mouse);
    glutMainLoop();

}
Example #14
0
main(int argc, char *argv[])
{
	dimention[dimIter].height = HEIGHT;
	dimention[dimIter].width = WIDTH;
	dimention[dimIter].cx = CENTERX;
	dimention[dimIter].cy = CENTERY;
	makeImage();
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB );
    glutInitWindowSize(N, M);
    glutCreateWindow("mandlebrot");
    myinit();
	glutMouseFunc(mouse);
	glutMotionFunc(activeMouse);
	glutKeyboardFunc(key);
    glutReshapeFunc(myReshape);
    glutDisplayFunc(display);

    glutMainLoop();


}
Example #15
0
/*  Main Loop
 *  Open window with initial window size, title bar, 
 *  RGBA display mode, and handle input events.
 */
int 
main(int argc, char **argv)
{
    int submenu;

    glutInit(&argc, argv);
    glutInitWindowPosition(500, 500);
    glutInitWindowSize(500, 500);
    glutCreateWindow(argv[0]);
    myinit();
    glutReshapeFunc(myReshape);
    glutDisplayFunc(display);
    submenu = glutCreateMenu(polygon_mode);
    glutAddMenuEntry("Filled", 1);
    glutAddMenuEntry("Outline", 2);
    glutCreateMenu(main_menu);
    glutAddMenuEntry("Quit", 666);
    glutAddSubMenu("Polygon mode", submenu);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutMainLoop();
    return 0;             /* ANSI C requires main to return int. */
}
Example #16
0
int main(int argc, char **argv)
{
	int submenu;
	glutInit(&argc, argv);
	glutInitWindowSize(W, H);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutCreateWindow(argv[0]);
	myinit();glutReshapeFunc(myReshapep);
	glutDisplayFunc(displayp);
	submenu = glutCreateMenu(polygon_mode);
	glutAddMenuEntry("Filled", 1);
	glutAddMenuEntry("Outline", 2);
	glutCreateMenu(main_menu);
	glutAddMenuEntry("Quit", 666);
	glutAddSubMenu("Polygon mode", submenu);
	glutPassiveMotionFunc(passive);
	glutEntryFunc(entry);
	glutMenuStatusFunc(mstatus);
	glutMouseFunc(clickp);
	glutMainLoop();
	return 0;
}
int main(int argc, char **argv)
{
	glutInit(&argc, argv);

	
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(window_width, window_height);
	glutInitWindowPosition(0,100);
	glutCreateWindow("PG - OpenGL Template");
	
	glutDisplayFunc(mydisplay);
	glutReshapeFunc(myreshape);
	glutMouseFunc(handleMouse);
	glutMotionFunc(handleMotion);
	glutKeyboardUpFunc(hadleKeyboard);
	glutSpecialUpFunc(hadleSpecialKeyboard);

	myinit();

	glutMainLoop();
	return 0;
}
Example #18
0
void BasicDemo::renderme()
{

	
	myinit();

	updateCamera();
	
	glDisable(GL_LIGHTING);
	//glDisable(GL_LIGHT0);
	
	
	if (m_blendReader)
	{
		for (int i=0;i<m_blendReader->m_renderMeshes.size();i++)
		{
			m_blendReader->m_renderMeshes[i]->render();
		}
	}
	
	
	
}
Example #19
0
int main(int argc, char **argv)
{
    /*for(int i=0;i<25;i++)
    	for(int j=0;j<25;j++)
    		 allowed[i][j]=1;*/

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowSize(500, 500);
	glutInitWindowPosition(400,100);
	glutCreateWindow("Knight Move");
	glutCreateMenu(demo_menu);
    //glutAddMenuEntry("Restart",1);
	glutAddMenuEntry("Exit",1);
	glutAttachMenu(GLUT_RIGHT_BUTTON);
    glutDisplayFunc(display);
    glutReshapeFunc(resizeHandler);
//    glutIdleFunc(spinDisplay);
    glutMouseFunc(myMouse);
    myinit();
    a();
    glutMainLoop();
}
Example #20
0
int main(int argc, char** argv)
{
    
    /* GLUT functions to set up the window */
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA | GLUT_DEPTH);
    glutInitWindowPosition (0, 0);
	glutInitWindowSize(SCREENW, SCREENH);
	glutInit(&argc, argv);
    glutCreateWindow (argv[0]);
    //  Enable Z-buffer depth test
	glEnable(GL_DEPTH_TEST);
    
    myinit();			/* Initialization */
    glutReshapeFunc (myReshape); /* Function to call when window changes size */
    glutDisplayFunc(RenderScene); /* Creating the Szene */
   // glutIdleFunc(spinDisplay);

    glutKeyboardFunc(myKeyboard);
    glutSpecialFunc(mySpecial);
    glutMouseFunc(myMouse);
    glutMainLoop();
	return 0;
}
void BasicDemo3D::renderme()
{
	updateCamera();

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	if(gDrawWire)
	{
		glColor3f(1.f, 1.f, 1.f);
		glDisable(GL_LIGHTING);
		setTexturing(false);
	}
	else
	{
		myinit();
		setTexturing(true);
	}
		
	renderscene(0);

	if(gbDrawBatches)
	{
		((btCudaDemoDynamicsWorld3D*)m_dynamicsWorld)->debugDrawConstraints(gSelectedBatch, cBatchColorTab);
	}
	glColor3f(0, 0, 0);
	if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0)
	{
		setOrthographicProjection();
		int  xOffset = 10.f;
		int  yStart = 20.f;
		int  yIncr = 20.f;
		showProfileInfo(xOffset, yStart, yIncr);
		DrawConstraintInfo();
		outputDebugInfo(xOffset, yStart, yIncr);
		resetPerspectiveProjection();
	}
}
Example #22
0
int main(int argc, char** argv)
{
    //Puck status text
    strcpy(text[0],"Shoot the puck!");
    strcpy(text[1],"What a goal!");
    strcpy(text[2], "Everything, but net!");
    strcpy(text[3], "The puck hits the left post!");
    strcpy(text[4], "The puck hits the right post!");
    strcpy(text[5], "The puck hits the crossbar!");
    strcpy(text[6], "Shoot it a little harder, guy!");
    
	glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(1000,1000);
	glutInitWindowPosition(50,50);
	glutCreateWindow("Hockey Guy");
    glEnable(GL_DEPTH_TEST);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    readPPM(BOARDS);
    generateTextures(0);
    readPPM(ICE);
    generateTextures(1);
    readPPM(NET);
    generateTextures(2);
    readPPM(STICK);
    generateTextures(3);
    readPPM(WALL);
    generateTextures(4);
    myinit();
	glutDisplayFunc(display);
    glutIdleFunc(idle);
    glutKeyboardFunc(keys);
    glutSpecialFunc(special);
	glutMainLoop();
	
	return 0;
}
Example #23
0
int main(int argc, char **argv)
{

  //If argument count < 2 or if the second argument is < 0 set defaults
  if(argc <  2 || atoi(argv[1])<0 || atoi(argv[1])>9)
  {
	n = 4;
	orig = 4;
  }
  else //otherwise take input from the command line
  {
    n=atoi(argv[1]); 
    orig = atoi(argv[1]); // keep the orginal so that 'o' can be used to go back 
			  // to the original input if desired
  }
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(500, 500);
    glutCreateWindow("Koch Snowflake");
    glutDisplayFunc(display);
    myinit();

    //Menu
    glutCreateMenu(main_menu);
    glutAddMenuEntry("Clear Screen", 0);
    glutAddMenuEntry("Redraw Snowflakes", 1);
    glutAddMenuEntry("Quit", 4);
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    glutIdleFunc(refresher);//Constantly refresh to calculate hertz
    glutPassiveMotionFunc(passiveMouseLocation); //update mouse location
    glutMotionFunc(movingMouse); //Mouse dragging events
    glutMouseFunc(myMouse); //Mouse click events
    glutKeyboardFunc(myKey); //Keyboard events
    glutSpecialFunc(specialKeys); //Special keyboard events
    glutMainLoop();
}
Example #24
0
int
main(int argc, char **argv)
{
#ifdef GLUT
  /* start of glut windowing and control functions */
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
  glutInitWindowSize(800, 600);
  glutCreateWindow("glutmech: Vulcan Gunner");
  myinit();
  glutDisplayFunc(display);
  glutReshapeFunc(myReshape);
#ifdef GLUT_KEY
  glutKeyboardFunc(keyboard);
#endif
#ifdef GLUT_SPEC
  glutSpecialFunc(special);
#endif
  glutMenu();
  glutMainLoop();
  /* end of glut windowing and control functions */
#endif
  return 0;             /* ANSI C requires main to return int. */
}
Example #25
0
File: base.c Project: felx/detritus
int main(int argc, char **argv) {
	n = 0;
	mode = 1;
	aspect = 1.0;
	rotating = 0;

	if (argc == 4) {
		eye[0] = atof(argv[1]);
		eye[1] = atof(argv[2]);
		eye[2] = atof(argv[3]);
	}

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(500, 500);
	glutCreateWindow("sphere");
	myinit();
	glutReshapeFunc(myReshape);
	glutDisplayFunc(display);
	glutKeyboardFunc(keyboard);
	glutMainLoop();
	
	return 0;
}
Example #26
0
File: anim.cpp Project: llevar/uoft
int main(int argc, char** argv) {
  glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowPosition (400, 400);
  glutInitWindowSize(600,600);
  imageWindowID = glutCreateWindow(argv[0]);

  myinit();
  initDofs();

  glutReshapeFunc (myReshape);
  glutKeyboardFunc( glut_key_action );
  glutMouseFunc (handleMouse);
  glutMotionFunc (handleMouseMotion);

  instructions();
	
  glutIdleFunc(NULL);
  glutTimerFunc(33,handle_timer,0);

  glutDisplayFunc(display);
  setupUI(imageWindowID);
//    glutMainLoop();
  return 0;         // never reached
}
int main(int argc, char **argv) {

	/* Inicia a janela da aplicacao */
	glutInit(&argc, argv);

	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(window_width, window_height);
	glutInitWindowPosition(40, 50);
	glutCreateWindow("B-Spline Cubica C2");

	glutDisplayFunc(mydisplay);
	glutReshapeFunc(myreshape);
	glutMouseFunc(handleMouse);
	glutMotionFunc(handleMotion);
	glutKeyboardUpFunc(hadleKeyboard);
	glutSpecialUpFunc(hadleSpecialKeyboard);
	//

	myinit();

	glutMainLoop();

	return 0;
}
Example #28
0
int main (int argc, char ** argv)
{
  if (argc<2)
  {  
    printf ("usage: %s heightfield.jpg\n", argv[0]);
    exit(1);
  }

  g_pHeightData = jpeg_read(argv[1], NULL);
  if (!g_pHeightData)
  {
    printf ("error reading %s.\n", argv[1]);
    exit(1);
  }

   glutInit(&argc,argv);
   // request double buffer

   //initialize
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA);
   
   // set window size
   glutInitWindowSize(640, 480);
   
   // set window position
   glutInitWindowPosition(0, 0);
   
    
   // creates a window
   glutCreateWindow("First Open GL Project");


   
   // enable depth buffering
  glEnable(GL_DEPTH_TEST);
  glShadeModel(GL_SMOOTH);            // interpolate colors during rasterization

  


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

  
  /* 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);
  
  /* 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);


  //connect to keyboard function
  glutKeyboardFunc(keyboardFunciton);

  /* do initialization */
  myinit();

  glutMainLoop();
  return(0);
}
Example #29
0
//Main
void main(int argc, char** argv)   
{   
    int wmain; 
    glutInit(&argc,argv); 
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); 
    glutInitWindowSize(WINW,WINH); 
    glutInitWindowPosition(50,50); 
    wmain=glutCreateWindow("Finestra Principale");//creo la finestra principale e la chiamo wmain 
    GLUI *glui=GLUI_Master.create_glui("Opzioni");//crea un oggetto di tipo glui che invoca il metodo createglui 
      
    //Pannello Colore Sfondo 
    pannello_sfondo=glui->add_rollout("Gestione Colore Sfondo",false); 
    spinner_SF_r=glui->add_spinner_to_panel(pannello_sfondo,"Rosso",GLUI_SPINNER_FLOAT,&rosso_sf);//aggiungo spinner al pannello 
    spinner_SF_r->set_float_limits(0,1);//limiti dello spinner 
    spinner_SF_g=glui->add_spinner_to_panel(pannello_sfondo,"Verde",GLUI_SPINNER_FLOAT,&verde_sf); 
    spinner_SF_g->set_float_limits(0,1); 
    spinner_SF_b=glui->add_spinner_to_panel(pannello_sfondo,"Blu",GLUI_SPINNER_FLOAT,&blu_sf); 
    spinner_SF_b->set_float_limits(0,1); 
    //----------------------------------- 
  
    //Pannello Colore Disegno 
    pannello_primitive=glui->add_rollout("Gestione Colore Disegno",false); 
    spinner_DIS_r=glui->add_spinner_to_panel(pannello_primitive,"Rosso",GLUI_SPINNER_FLOAT,&rosso_dis); 
    spinner_DIS_r->set_float_limits(0,1); 
    spinner_DIS_g=glui->add_spinner_to_panel(pannello_primitive,"Verde",GLUI_SPINNER_FLOAT,&verde_dis); 
    spinner_DIS_g->set_float_limits(0,1); 
    spinner_DIS_b=glui->add_spinner_to_panel(pannello_primitive,"Blu",GLUI_SPINNER_FLOAT,&blu_dis); 
    spinner_DIS_b->set_float_limits(0,1); 
    //------------------------------------ 
  
    //Pannello Scelta Parametrizzazione 
    pannello_scelte=glui->add_rollout("Scelta Parametrizzazione",false);//creo un pannello 
    radio_scelte=glui->add_radiogroup_to_panel(pannello_scelte,&scelta_param);//costruisco il radiogruppo 
    glui->add_radiobutton_to_group(radio_scelte,"Uniforme");//gli attacco i bottoni(sono mutuamente esclusivi) 
    glui->add_radiobutton_to_group(radio_scelte,"Secondo le Corde"); 
    //------------------------------------ 
  
    //Pannello Hermite 
    pannello_Hermite=glui->add_rollout("Hermite",false);//creo un pannello 
    bottone_Hermite=glui->add_button_to_panel(pannello_Hermite,"Hermite",1,metodi);//passo il valore 1 alla funzione metodi 
    check_box_mod_der=glui->add_checkbox_to_panel(pannello_Hermite,"Modifica Derivata",&mod_der); 
    indice_pto_mod=glui->add_spinner_to_panel(pannello_Hermite,"Indice Punto da Modificare",GLUI_SPINNER_INT,&ip); 
    derivata_x=glui->add_spinner_to_panel(pannello_Hermite,"Componente X della Derivata",GLUI_SPINNER_FLOAT,&val_der_x); 
    derivata_y=glui->add_spinner_to_panel(pannello_Hermite,"Componente Y della Derivata",GLUI_SPINNER_FLOAT,&val_der_y); 
    //------------------------------------ 
  
    //Pannello Bezier 
    pannello_Bezier=glui->add_rollout("Bezier",false);//creo un pannello 
    bottone_Bezier=glui->add_button_to_panel(pannello_Bezier,"Bezier",2,metodi);//passo il valore 1 alla funzione metodi 
    check_box_subd=glui->add_checkbox_to_panel(pannello_Bezier,"Subdivision",&subd); 
    suddivisione=glui->add_spinner_to_panel(pannello_Bezier,"Parametro per la Suddivisione",GLUI_SPINNER_FLOAT,&t_sub); 
    check_box_degree=glui->add_checkbox_to_panel(pannello_Bezier,"DegreeElevation",&d_el); 
    degreeelev=glui->add_spinner_to_panel(pannello_Bezier,"Numero Di Reiterazioni",GLUI_SPINNER_INT,&n_reit); 

	check_box_pesi_bezier=glui->add_checkbox_to_panel(pannello_Bezier,"PesiBezier",&mod_pesi_bez);
	i_peso_bezier=glui->add_edittext_to_panel(pannello_Bezier,"Indice Punto",GLUI_EDITTEXT_INT,&i_p_b); 
	valore_peso=glui->add_edittext_to_panel(pannello_Bezier,"Valore Peso",GLUI_EDITTEXT_FLOAT,&val_peso); 
    //------------------------------------ 
	
	//Pannello Spline
    pannello_Spline=glui->add_rollout("Spline",false);//creo un pannello 
    bottone_Spline=glui->add_button_to_panel(pannello_Spline,"Spline",3,metodi);//passo il valore 1 alla funzione metodi 
    check_box_moltep=glui->add_checkbox_to_panel(pannello_Spline,"Modifica Molteplicita",&mod_moltep); 
    indice_nodo_mod=glui->add_edittext_to_panel(pannello_Spline,"Indice Nodo",GLUI_EDITTEXT_INT,&i_nodo); 
    valore_moltep=glui->add_edittext_to_panel(pannello_Spline,"Molteplicità",GLUI_EDITTEXT_INT,&val_moltep); 

	check_box_pesi_spline=glui->add_checkbox_to_panel(pannello_Spline,"PesiSpline",&mod_pesi_spline);
	i_peso_spline=glui->add_edittext_to_panel(pannello_Spline,"Indice Punto",GLUI_EDITTEXT_INT,&i_p_s); 
	valore_pesos=glui->add_edittext_to_panel(pannello_Spline,"Valore Peso",GLUI_EDITTEXT_FLOAT,&val_pesos); 
	//------------------------------------

    //creo un edit text per cambiare la dimensione del punto 
    dim_vertice=glui->add_edittext("Dimensione Punto",GLUI_EDITTEXT_INT,&dimpunto); 
    //------------------------------------ 
  
    glui->set_main_gfx_window(wmain);//dico a tutti a quale finestra si devono riferire 
  
    glutDisplayFunc(display); 
    glutMouseFunc(myMouse); 
	glutMotionFunc(myMotion);
    myinit(); 
    glutMainLoop(); 
}
void hadleSpecialKeyboard(int key, int x, int y)
{
	if(key == GLUT_KEY_F5){
		myinit();
	}
}