Пример #1
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("Matrix Example");
    createGLUTMenus();  
    // 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;
    }


    // 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(myMouse);



    // 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;
}
Пример #2
0
/***********************************************************
					MAINLOOP
************************************************************/
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{

	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(200, 0);
	glutInitWindowSize(w,h);
	glutCreateWindow("Sculpteo");

	glutKeyboardFunc(processNormalKeys);
	glutReshapeFunc(reshape);
	glutDisplayFunc(display);
	glutIdleFunc(display);
	glutMouseFunc(mouse);

	NUIinit();
	initRender();
	uiInit();
	createGLUTMenus();
	glutMainLoop();

	
	return 0;
}
Пример #3
0
Файл: main.cpp Проект: Sebu/CG2
// nehe.gamedev.net basic code MAIN
int main ( int argc, char** argv )  
{

	// ein paar infos fuer die konsole
	cout << "linke Maustaste \t ... x-y Bewegung" << endl;
	cout << "linke Maustaste + Strg \t ... x-y Drehen" << endl;
	cout << "linke Maustaste + Alt \t ... x-y Licht Drehen" << endl;
    cout << "mittlere Maustaste \t ... Zoom" << endl;
	cout << "rechte Maustaste  \t ... Menu" << endl;



	// model laden, kd-tree erzeugen und radius und k naechsten punkt(e) ermitteln
	model = new gx_model();
	model2 = new gx_model();
	modelNormal = new gx_model();
	
	if (argc < 6) {
		cout << "nicht genug Parameter" << endl;
		model->load_off("cat.off", 1);
	} else {

		model->load_off(argv[1], atoi(argv[5]));

	}
	
	
	// bbox etwas vergrößern
    model->box->sizeUp(0.15f);
    model->createKdtree(20);
    model->genExtraPoints();
    model2->crep = atof(argv[2]);
    model2->qual = atof(argv[3]);
    model2->k = atoi(argv[4]);
	model2->load_data("testa.off", atoi(argv[5]), *model);
	modelNormal->load_data("testa.off", atoi(argv[5]), *model);
    cout << model2->crep << " " << model2->qual << " " << model2->k << endl;



   
	//nehe.gamdev.net basic code standard init fuer glut
	glutInit            ( &argc, argv ); 
	glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE );
	glutInitWindowSize  ( 640, 480 ); 

	glutCreateWindow    ( "Blatt4 Dreiecksnetze" ); 
	glutDisplayFunc     ( display );  
	
	glutReshapeFunc     ( reshape );
	glutKeyboardFunc    ( keyboard );
	glutMouseFunc		( mouse );
	glutMotionFunc		( mousemotion );
	glutSpecialFunc		( arrow_keys );
	glutIdleFunc		( display );
	createGLUTMenus();
	init();
	
	// lichteinstellungen
	glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);	
	glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);	
	glEnable(GL_LIGHT0);	
	glEnable(GL_NORMALIZE);
	glColorMaterial ( GL_FRONT_AND_BACK , GL_AMBIENT_AND_DIFFUSE ) ;	
    glEnable(GL_LIGHTING);
    

    
	glutMainLoop        ( );   

	return 0;
}