コード例 #1
0
ファイル: assign1.cpp プロジェクト: Youmna-Salah/Projects
int main(int argc, char** argr) {
    glutInit(&argc, argr);
    glutInitWindowSize(800, 800);
    glutInitWindowPosition(150, 150);
    glutCreateWindow("King of theives");
    glutDisplayFunc(Display);
    glutIdleFunc(anim);
    glutKeyboardFunc(Key);
    glutKeyboardUpFunc(KeyUp);  // sets the KeyboardUp handler function; called when a key is released
    glutTimerFunc(0, Timer, 0); // sets the Timer handler function; which runs every `Threshold` milliseconds (1st argument)
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glClearColor(1, 1, 1, 0);
    gluOrtho2D(0, 800, 0, 800);
    
    glutMainLoop();
    return 0;
}
コード例 #2
0
ファイル: practica02.c プロジェクト: pabposta/pang3d
int main (int argc, char *argv[])
{
	
	// inicializar glut
	glutInit (&argc, argv);
	glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowSize (TAMANYOVENTANA, TAMANYOVENTANA);
	glutInitWindowPosition (200, 200);
	glutCreateWindow ("practica 02");
	glutDisplayFunc (display);
	glutReshapeFunc (reshape);
	glEnable (GL_DEPTH_TEST);
	glLineWidth (1.4);
	glutWarpPointer (TAMANYOVENTANA / 2, TAMANYOVENTANA / 2);

	glutIdleFunc (idle);
	
	glutPassiveMotionFunc (motion);
	glutMotionFunc (motion);
	glutKeyboardFunc (keyboard);
	glutKeyboardUpFunc (keyboardUp);
	glutSpecialFunc (special);
	glutSpecialUpFunc  (specialUp);
	glutMouseFunc (mouse);
		
	// inicializar sdl
	SDL_Init (SDL_INIT_AUDIO | SDL_INIT_TIMER);

	// inicializar alut
	alutInit (&argc, argv);
	
	cargarSonido();

	inicializar();
	
	imprimirInstrucciones();

	atexit (salir);


	glutMainLoop();

	
	return 0;

}
コード例 #3
0
void graphicsInit(int argc, char **argv) {

	glutInit(&argc, argv); // Initialize GLUT
	glutInitDisplayMode (GLUT_SINGLE); // Set up a basic display buffer (only single buffered for now)
	glutInitWindowSize (1000, 900); // Set the width and height of the window
	glutInitWindowPosition (100, 100); // Set the position of the window
	glutCreateWindow ("LP Simulation"); // Set the title for the window

	glutDisplayFunc(display); // Tell GLUT to use the method "display" for rendering

	glutReshapeFunc(reshape); // Tell GLUT to use the method "reshape" for reshaping

	glutKeyboardFunc(keyPressed); // Tell GLUT to use the method "keyPressed" for key presses
	glutKeyboardUpFunc(keyUp); // Tell GLUT to use the method "keyUp" for key up events

	glutMainLoop(); // Enter GLUT's main loop
}
コード例 #4
0
ファイル: main.cpp プロジェクト: DustinLim/IN4152-game
int main(int argc, char** argv)
{
    glutInit(&argc, argv);

    // couches du framebuffer utilisees par l'application
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );

    // position et taille de la fenetre
    glutInitWindowPosition(20, 80);
    glutInitWindowSize(W_fen,H_fen);
    glutCreateWindow(argv[0]);

	// Windows only exposes OpenGL 1.1 functions.
	// To call more modern functions, we need to load GLEW.
	#if defined(_WIN32)
		GLenum err = glewInit();
		(GLEW_OK != err) ? printf("GLEW init failed!\n") : printf("GLEW init complete\n");
	#endif

    init( );
	
    // Initialize viewpoint
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0,0,-4);
    tbInitTransform();     
    tbHelp();

	// cablage des callback
    glutReshapeFunc(reshape);
	glutIgnoreKeyRepeat(1); 
    glutKeyboardFunc(keyboard); //call *once* on keydown
	glutKeyboardUpFunc(keyboardUp);
    glutDisplayFunc(displayInternal); 
	glutMouseFunc(mouse);
	glutMotionFunc(mouseMotion);  // traqueboule utilise la souris
	glutPassiveMotionFunc(mousePassiveMotion);
    glutIdleFunc(animate);
	glutTimerFunc(firstEnemySpawnDelay, spawnEnemy, 0);
	glutTimerFunc(bossSpawnDelay, spawnBoss, 0);

    // lancement de la boucle principale
    glutMainLoop();
    
    return 0;  // instruction jamais exécutée
}
コード例 #5
0
ファイル: Engine.cpp プロジェクト: akkenoth/eel
void Engine::initGLUT() {
	int argc = 1;
	char *argv[] = {"Bin", NULL};
	glutInit(&argc, argv);

	if(context->core) {
		glutInitContextVersion(context->majorVersion, context->minorVersion);
		glutInitContextProfile(GLUT_CORE_PROFILE);
	} else {
		glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE);
	}

	glutInitDisplayMode(framebuffer->flags);
	glutInitWindowPosition(window->positionX, window->positionY);
	glutInitWindowSize(window->width, window->height);
	// in case GL_DEBUG_OUTPUT doesn't work
	// glutInitContextFlags(GLUT_DEBUG);
	glutCreateWindow(window->name.c_str());

	std::cout << "GLUT initialized\n";
	glEnable(GL_DEBUG_OUTPUT);

	glutSetWindowData(static_cast<void *>(this));

	glutIdleFunc(idleCallback);
	glutDisplayFunc(displayCallback);
	glutReshapeFunc(reshapeCallback);
	glutCloseFunc(closeCallback);

	glutKeyboardFunc(handleKeyboardCallback);
	glutKeyboardUpFunc(handleKeyboardUpCallback);
	glutSpecialFunc(handleKeyboardSpecialCallback);
	glutSpecialUpFunc(handleKeyboardSpecialUpCallback);
	glutMotionFunc(handleMouseMovement);
	glutPassiveMotionFunc(handleMouseMovement);

	initGLEW();

	glDebugMessageCallback(DebugOutput::printDebugOutput, NULL);
	//GLenum severity = GL_DEBUG_SEVERITY_LOW | GL_DEBUG_SEVERITY_MEDIUM | GL_DEBUG_SEVERITY_HIGH | GL_DEBUG_SEVERITY_NOTIFICATION;
	glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
	glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_NOTIFICATION, 0, NULL, GL_FALSE);
	glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);

	std::cout << "Info | Vendor: " << glGetString(GL_VENDOR) << " | Renderer: " << glGetString(GL_RENDERER) << " | OpenGl version: " << glGetString(GL_VERSION) << std::endl;
}
コード例 #6
0
ファイル: Violet.cpp プロジェクト: eatfears/violet
void GlutInit()
{
	glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF) ;

	glutKeyboardFunc(KeyboardDown);
	glutKeyboardUpFunc(KeyboardUp);
	glutSpecialFunc(SpecialDown);
	glutSpecialUpFunc(SpecialUp);
	glutMouseFunc(MouseButton);
	glutMotionFunc(MouseMotion);
	glutPassiveMotionFunc(MouseMotion);
	glutDisplayFunc(Display);
	glutIdleFunc(Display);
	glutReshapeFunc(Reshape);
	glutEntryFunc(MouseEntry);
	//glutVisibilityFunc(visible);
}
コード例 #7
0
ファイル: mountain.cpp プロジェクト: anneomcl/FlightCamera
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
	init();
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keyboard);
	glutKeyboardUpFunc(keyUp);
	glutTimerFunc(100, timer, 30);

	glutMainLoop();
	return 0;
}
コード例 #8
0
ファイル: glutwidget.cpp プロジェクト: Kurispy/mandelbrot
/*
 Initializes GLUT context
 */
glutWidget::glutWidget(int argc, char** argv)
{
    
    m_frame = 0;
    glutInitWindowSize(glutWidget::m_width, glutWidget::m_height);
    glutInit(&argc,argv);
    glutInitDisplayString("samples rgb double depth");
    glutCreateWindow("Mandelbrot");
    glutMouseFunc(mouseHandler);     //what to call when user clicks or scrolls
    glutKeyboardFunc(keyDown);       //what to call when user presses a key
    glutKeyboardUpFunc(keyUp);       //what to call when user releases a key
    glutSpecialFunc(specialKeyDown); //what to call when user presses a special key
    glutSpecialFunc(specialKeyUp);   //what to call when user releases a special key
    glutDisplayFunc(render);         //what to call when window needs redrawing
    glutIdleFunc(update);            //what to call when no user input given
    initOpenGL();
}
コード例 #9
0
ファイル: gui.cpp プロジェクト: COHRINT/cuTORCS
/** Deactivate the current screen.
    @ingroup	gui
 */
void
GfuiScreenDeactivate(void)
{
	if (GfuiScreen->onDeactivate) GfuiScreen->onDeactivate(GfuiScreen->userDeactData);
	
	GfuiScreen = (tGfuiScreen*)NULL;
	
	glutKeyboardFunc((void(*)(unsigned char,int,int))NULL);
	glutSpecialFunc((void(*)(int,int,int))NULL);
	glutKeyboardUpFunc((void(*)(unsigned char,int,int))NULL);
	glutSpecialUpFunc((void(*)(int,int,int))NULL);
	glutMouseFunc((void(*)(int,int,int,int))NULL);
	glutMotionFunc((void(*)(int,int))NULL);
	glutPassiveMotionFunc((void(*)(int,int))NULL);
	glutIdleFunc((void(*)(void))NULL);
	glutDisplayFunc(GfuiDisplayNothing);
}
コード例 #10
0
ファイル: main.cpp プロジェクト: AvatarHurden/DigDug-II
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitWindowSize(WINDOW_WIDTH,WINDOW_HEIGHT);
    glutInitWindowPosition(0,0);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("OBJ Loader - GLM + GLMIMG + TGA TEXTURE");

    C3DObject_Load("penguin.obj");

    glutReshapeFunc(resize);
    glutDisplayFunc(display);

	glutKeyboardFunc(onKeyDown);
	glutKeyboardUpFunc(onKeyUp);
    glutIdleFunc(idle);

    glClearColor(1,1,1,1);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    glEnable(GL_LIGHT0);
    glEnable(GL_NORMALIZE);
    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_LIGHTING);

    glLightfv(GL_LIGHT0, GL_AMBIENT,  light_ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE,  light_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glMaterialfv(GL_FRONT, GL_AMBIENT,   mat_ambient);
    glMaterialfv(GL_FRONT, GL_DIFFUSE,   mat_diffuse);
    glMaterialfv(GL_FRONT, GL_SPECULAR,  mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);

    initialize();

    glutMainLoop();

    return EXIT_SUCCESS;
}
コード例 #11
0
/* main program - setup window using GLUT */ 
int main(int argc, char **argv)
{
	
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);						// Hidden surface removal renders the scene such that the nearest surface rendered to the viewer is seen as the closest visible surface. By using a depth buffer, each rendered pixel in the depth buffer stores the distance to the previously rendered surface. Depending on the depth mode used, i.e. LESS for instance, if the new surface is closer to the view then the value of thedepth pixel is replaced otherwise is discarded and not rendered.
    glutInitWindowSize(1000, 500);
    glutCreateWindow("3D Maze Game");
    glutDisplayFunc(display);
    initgl();
	glutKeyboardFunc(keyboard_interaction);	
	glutKeyboardUpFunc(keyboard_up);
	glutMouseFunc(SpecialKeyStrokes);
	glutTimerFunc(17, timer, 0); //Add a timer
	glutMainLoop();
    return  0;
	
}
コード例 #12
0
int main(int args, char **argv)
{
    glutInit(&args,argv);											//glut的初始化函数,负责处理命令行参数,在这里我们只需记住它是用glut搭建Opengl显示环境必须要第一个调用的函数
    glutInitWindowPosition(500,500);								//glut的窗口初始化函数,设定了绘图窗口左上角在整个屏幕上的坐标(以像素为单位,下同)
    glutInitWindowSize(500,500);									//glut的窗口初始化函数,设定了绘图窗口的大小
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH);			//将窗口显示模式设定为双缓冲、RGBA颜色模式并且带深度缓存,在完成本次作业后,可以去掉或者修改这三个参数中的任意一个,看看显示结果会有什么不同,为什么会这样呢?
    glutCreateWindow("BNU CG Lab1_1 例程");							//创建一个名为"GLUT Framework(BNU CG Lab1)"的窗口,如果把这一行放在上面三个函数任意一个之前呢?
    GLInit();														//初始化OpenGL的函数
    glutDisplayFunc(GLRender);										//显示回调函数的设定,在这里我们将回调函数设定为之前已经定义的GLRender函数,注意这里对回调函数本身的参数和返回值的要求
    glutReshapeFunc(GLReshape);										//窗口大小调整回调函数的设定,在这里我们将回调函数设定为之前已经定义的GLReshape函数,注意这里对回调函数本身的参数和返回值的要求
    glutIdleFunc(GLPostRedisplay);
    glutKeyboardFunc(GLKeyDown);
    glutKeyboardUpFunc(GLKeyUp);
    glutMouseFunc(GLMouse);
    glutMainLoop();													//只有调用了这个函数,才会出现绘图窗口
    return 0;
}
コード例 #13
0
ファイル: lesson6.c プロジェクト: prongs/roadfighter
int main(int argc, char **argv) 
{  
    /* Initialize GLUT state - glut will take any command line arguments that pertain to it or 
       X Windows - look at its documentation at http://reality.sgi.com/mjk/spec3/spec3.html */  
    glutInit(&argc, argv);  

    /* Select type of Display mode:   
     Double buffer 
     RGBA color
     Alpha components supported 
     Depth buffer */  
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);  

    /* get a 640 x 480 window */
    glutInitWindowSize(640, 480);  

    /* the window starts at the upper left corner of the screen */
    glutInitWindowPosition(0, 0);  

    /* Open a window */  
    window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99");  

    /* Register the function to do all our OpenGL drawing. */
    glutDisplayFunc(&DrawGLScene);  

    /* Go fullscreen.  This is as soon as possible. */
    glutFullScreen();

    /* Even if there are no events, redraw our gl scene. */
    glutIdleFunc(&DrawGLScene);

    /* Register the function called when our window is resized. */
    glutReshapeFunc(&ReSizeGLScene);

    /* Register the function called when the keyboard is pressed. */
    glutKeyboardFunc(&keyPressed);
    glutKeyboardUpFunc(&keyup);

    /* Initialize our window. */
    InitGL(640, 480);
  
    /* Start Event Processing Engine */  
    glutMainLoop();  

    return 1;
}
App::App(int* argc, char** argv) : width(800), height(800), bullet(shadow),
lightpos({ 0, -200, 0, 1} ),lightpos2({ 0, 50, 0, 1 }){
  glutInit(argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(width, height);
  glutInitWindowPosition(0, 0);
  glutCreateWindow("Program OpenGL");
  glutDisplayFunc(DisplayFrameCallback);
  glutIdleFunc(NextFrameCallback);

  glewInit();
  glutKeyboardFunc(KeyDownCallback);
  glutKeyboardUpFunc(KeyUpCallback);
  glutSpecialFunc(KeySpecialDownCallback);
  glutSpecialUpFunc(KeySpecialUpCallback);
  glutMouseFunc(MouseFuncCallback);
  ResetPointer();
  glutSetCursor(GLUT_CURSOR_NONE);
  glutPassiveMotionFunc(MotionFuncCallback);

  GLfloat ambient[] = { 0.2f, 0.2f, 0.2f, 1.0f };
  GLfloat diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  GLfloat specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };

  glMaterialfv(GL_LIGHT0, GL_AMBIENT, ambient);
  glMaterialfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
  glMaterialfv(GL_LIGHT0, GL_SPECULAR, specular);
  glMateriali(GL_FRONT, GL_SHININESS, 50);

  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_BLEND);

  glEnable(GL_NORMALIZE);
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_LIGHT1);
  glShadeModel(GL_SMOOTH);
  glEnable(GL_TEXTURE_2D);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_COLOR_MATERIAL);
  bullet.AddLevel();

  LoadTexture(0, "bricks.bmp");
  LoadTexture(1, "ntex.bmp");
}
コード例 #15
0
ファイル: obj.c プロジェクト: cjxgm/clabs
int main(int argc, char * argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowSize(640, 480);
	glutCreateWindow("Load Wavefront Obj");
	glutIdleFunc(&render);
	glutKeyboardFunc(&key_down);
	glutKeyboardUpFunc(&key_up);

	glMatrixMode(GL_PROJECTION);
	gluPerspective(45, 640.0 / 480.0, 1, 100);
	glMatrixMode(GL_MODELVIEW);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	glEnable(GL_CULL_FACE);

	/* lighting */ {
		float light_pos[] = { 0, 0, 0, 1 };
		float white_light[] = { 1.1, 1.1, 1.1, 1 };
		float ambient[] = { 0.4, 0.4, 0.4, 1 };

		glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
		glLightfv(GL_LIGHT0, GL_DIFFUSE, white_light);
		glLightfv(GL_LIGHT0, GL_SPECULAR, white_light);
		glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
		glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

		glEnable(GL_LIGHTING);
		glEnable(GL_LIGHT0);
	}

	glClearColor(0, 0, 0, 0);
	glEnable(GL_DEPTH_TEST);
	glClearDepth(1.0);

	camInit();

	FILE * fp = fopen("xxx.obj", "r");
	go = load_obj(fp);
	fclose(fp);

	glutMainLoop();

	return 0;
}
コード例 #16
0
ファイル: testgl.cpp プロジェクト: Chingliu/llqtwebkit
int main( int argc, char* argv[] )
{
	glutInit( &argc, argv );
	glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB );

	// implementation in a class so we can observer events
	// means we need this painful GLUT <--> class shim...
	theApp = new testGL;

	if ( theApp )
	{
		glutInitWindowPosition( 80, 0 );
		glutInitWindowSize( theApp->getAppWindowWidth(), theApp->getAppWindowHeight() );

		glutCreateWindow( theApp->getAppWindowName().c_str() );

		std::string url = "";
		if ( 2 == argc )
			url = std::string( argv[ 1 ] );

		theApp->init( std::string( argv[ 0 ] ), url );

		glutKeyboardFunc( glutKeyboard );
		glutKeyboardUpFunc( glutKeyboardUp );
		glutSpecialFunc( glutSpecial );
		glutSpecialUpFunc( glutSpecialUp );

		glutMouseFunc( glutMouseButton );
		glutPassiveMotionFunc( glutMouseMove );
		glutMotionFunc( glutMouseMove );

		glutDisplayFunc( glutDisplay );
		glutReshapeFunc( glutReshape );

		glutIdleFunc( glutIdle );

		glutMainLoop();
		
		std::cout << "glutMainLoop returned" << std::endl;
		
		delete theApp;
	};

	return 0;
}
コード例 #17
0
void GraphicsEngine::initialize(int argc, char **argv)
{
	// Initialize the window.
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
	glutInitWindowSize(WIDTH, HEIGHT);

	// Create the window.
	this->mainWindow = glutCreateWindow(TITLE);

	// Set keyboard methods.
	glutKeyboardFunc(&onKeyDownCallback);
	glutKeyboardUpFunc(&onKeyUpCallback);
	glutSpecialFunc(&onSpecialKeyDownCallback);
	glutSpecialUpFunc(&onSpecialKeyUpCallback);

	// Set mouse callbacks.
	glutMouseFunc(&onMouseButtonCallback);
#ifdef FREEGLUT
	glutMouseWheelFunc(&onMouseWheelCallback);
#endif
	glutMotionFunc(&onMouseMotionCallback);
	glutPassiveMotionFunc(&onMousePassiveMotionCallback);

	// Set display callbacks.
	glutDisplayFunc(&onDrawCallback);
	glutReshapeFunc(&onReshapeCallback);

	// Set a timer to control the frame rate.
	glutTimerFunc(FRAME_PERIOD, onTimerTickCallback, 0);

	// Set clear color.
	glClearColor(1.0f, 1.0f, 1.0f, 1.0f);

	glDepthFunc(GL_ALWAYS);

	// Set shading model.
	glShadeModel(GL_SMOOTH);

	// Initialize texture loader.
	TextureLoader::initialize();

	// Subscribe to camera to change viewport ortho.
	Camera::getInstance()->subscribe(this);
}
コード例 #18
0
ファイル: game.cpp プロジェクト: pwon111/binary
void Game::setupOpenGLDisplay() {
    // setup gl functions
    glutDisplayFunc(Display::displayCallback);
    glutReshapeFunc(Display::reshapeCallback);
    glutMouseFunc(Display::mousePressedCallback);
    glutMotionFunc(Display::mouseMovedCallback);
    glutKeyboardFunc(Display::keyPressedCallback);
    glutKeyboardUpFunc(Display::keyReleasedCallback);
    glutSpecialFunc(Display::specKeyPressedCallback);
    glutSpecialUpFunc(Display::specKeyReleasedCallback);
    if (Display::display->dynamic) {
        Display::display->timer.resetClock();
        glutTimerFunc(
            1000 / Display::desired_fps,
            Display::timerCallback,
            Display::display->timer.checkClock(MICRO));
    }
}
コード例 #19
0
ファイル: test.cpp プロジェクト: ksingla025/3D-car-world
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutInitWindowSize(640,480);
    glutInitWindowPosition(1,1);
    glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE);
    glutCreateWindow("PC");
    glutDisplayFunc(draw);
    glutIdleFunc(draw);
    glutKeyboardUpFunc(keyup);
    glutKeyboardFunc(keyboard);
//	glutSetKeyCallback(handleKeypress);
//	glutSetKeyCallback(handleKeypress);
//	glutFullScreen();
    initialize();
    glutMainLoop();
    return 0;
}
コード例 #20
0
ファイル: main.c プロジェクト: damienfir/shooter
int main(int argc, char *argv[])
{
	glutInit(&argc,argv);
	glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
	glutInitWindowSize(1024,576);
	glutCreateWindow("Shooter");
	
	glutDisplayFunc(display);
	glutIdleFunc(idle);
	glutKeyboardFunc(keyboarddown);
	glutKeyboardUpFunc(keyboardup);

	setup();

	glutMainLoop();

	return 0;
}
コード例 #21
0
ファイル: teste_nave.c プロジェクト: Abello966/LabProgI
int main(int argc, char **argv){
  forceField = FALSE;
  initShip();
  initCenario();
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
  glutInitWindowSize(900, 900); 
  glutCreateWindow("Nave");
  init();
  
  glutDisplayFunc(draw);
  glutTimerFunc(100, timeStep, 1);
  glutIgnoreKeyRepeat(TRUE);
  glutKeyboardFunc(keydown);
  glutKeyboardUpFunc(keyup);
  glutMainLoop();
  return 0;   
}
コード例 #22
0
int main (int argc, char **argv) {
	glutInit(&argc, argv); // Initialize GLUT
	glutInitDisplayMode (GLUT_DOUBLE); // Set up a basic display buffer (now double buffered)
	glutInitWindowSize (500, 500); // Set the width and height of the window
	glutInitWindowPosition (100, 100); // Set the position of the window
	glutCreateWindow ("Your first OpenGL Window"); // Set the title for the window

	glutDisplayFunc(display); // Tell GLUT to use the method "display" for rendering

	glutIdleFunc(display); // Tell GLUT to use the method "display" as our idle method as well

	glutReshapeFunc(reshape); // Tell GLUT to use the method "reshape" for reshaping

	glutKeyboardFunc(keyPressed); // Tell GLUT to use the method "keyPressed" for key presses
	glutKeyboardUpFunc(keyUp); // Tell GLUT to use the method "keyUp" for key up events

	glutMainLoop(); // Enter GLUT's main loop
}
コード例 #23
0
ファイル: MedievalTown.cpp プロジェクト: flair2005/inVRs
int setupGLUT(int *argc, char *argv[]) {
	// setup the GLUT library which handles the windows for us
	glutInit(argc, argv);
	glutInitDisplayMode(GLUT_RGB| GLUT_DEPTH | GLUT_DOUBLE);

	int winid = glutCreateWindow("inVRs Tutorial: Medieval Town");

	glutReshapeFunc(reshape);
	glutDisplayFunc(display);
	glutMouseFunc(mouse);
	glutMotionFunc(motion);
	glutKeyboardFunc(keyboard);
	glutKeyboardUpFunc(keyboardUp);
	glutPassiveMotionFunc(motion);
	glutIdleFunc(display);

	return winid;
} // setupGLUT
コード例 #24
0
ファイル: curves.cpp プロジェクト: danignibus/curvesProject
//--------------------------------------------------------
// The entry point of the application
//--------------------------------------------------------
int main(int argc, char *argv[]) {
    glutInit(&argc, argv);                 		// GLUT initialization
    glutInitWindowSize(640, 480);				// Initial resolution of the MsWindows Window is 600x600 pixels
    glutInitWindowPosition(100, 100);            // Initial location of the MsWindows window
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);    // Image = 8 bit R,G,B + double buffer + depth buffer
    glutCreateWindow("Curves Editor");        	// Window is born
    
    glutKeyboardFunc(onKeyboard);
    glutKeyboardUpFunc(onKeyboardUp);
    //glutReshapeFunc(onReshape);
    glutMouseFunc(onMouse);
    glutDisplayFunc(onDisplay);                	// Register event handlers
    glutMotionFunc(onMouseMotionFunc);
    //   glutIdleFunc(onIdle);
    
    glutMainLoop();                    			// Event loop
    return 0;
}
コード例 #25
0
ファイル: glmain.c プロジェクト: Choino/school
/* This function sets up the windowing related glut calls */
void glut_setup (){

  glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
  glutInitWindowSize(700,700);
  glutInitWindowPosition(20,20);
  glutCreateWindow("Transformer");


  /* set up callback functions */
  glutDisplayFunc(my_display);
  glutReshapeFunc(my_reshape);
  glutMouseFunc(my_mouse);
  glutKeyboardFunc(my_keyboard);
  glutKeyboardUpFunc( my_keyboard_up );	
  glutTimerFunc( 20, my_TimeOut, 0 );/* schedule a my_TimeOut call with the ID 0 in 20 seconds from now */
  return;

}
コード例 #26
0
void initWindow(int argc, char** argv){
	glutInit(&argc, argv);
	//glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_MULTISAMPLE);
	glutInitDisplayString("rgba double depth=>12 samples>=8");
	glutInitWindowPosition(565, 0);
	glutInitWindowSize(500, 500);

	glutCreateWindow("HUniplacer 3D");

	// register callbacks
	glutSpecialFunc(specialHandler);
	glutSpecialUpFunc(specialUpHandler);
	glutKeyboardFunc(keyHandler);
	glutKeyboardUpFunc(keyUpHandler);
	glutDisplayFunc(render);
	glutReshapeFunc(resize);
	glutIdleFunc(render);
}
コード例 #27
0
ファイル: GameProcess.cpp プロジェクト: chester5009/snake3d
void GameProcess::Init(int argc, char **argv) {

	snake[0].x = 6;
	snake[0].y = 6;
	snake[1].x = 6;
	snake[1].y = 5;
	snake[2].x = 6;
	snake[2].y = 4;
	snake[3].x = 6;
	snake[3].y = 3;
	placeEat();
	camera = new Camera((float) N / 2.0, 15, 22);
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

	glutInitWindowSize(w, h);
	glutInitWindowPosition(100, 100);

	glutCreateWindow("Game_Snake");

	cout << "Sozdano" << endl;
	//glViewport(0, 0, w, h);
	//glMatrixMode(GL_PROJECTION);
	//glLoadIdentity();
	//gluPerspective(45.0f, (float) w / (float) h, 0.1, 1000);
	vector3 campos = camera->getPosition();
	//gluLookAt(campos.x, campos.y, campos.z, (float) N / 2.0, 0,
	//		-(float) M / 2.0, 0, 1, 0);
	//glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glutDisplayFunc(Draw);
	glutReshapeFunc(Reshape);
	glutTimerFunc(60, Timer, 0);
	glutTimerFunc(60, TimerUpdate, 0);

	glEnable(GL_DEPTH_TEST);
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);

	glutKeyboardFunc(KeyboardWrapper);
	glutKeyboardUpFunc(KeyboardUpWrapper);
	glutMainLoop();
}
コード例 #28
0
ファイル: WindowsManager.cpp プロジェクト: NassimAMGHAR/bras
void WindowsManager::createWindows(int argc, char** argv)
{
	glutInit(&argc, argv); 
	glutInitDisplayMode(GLUT_MULTISAMPLE | GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );

	if(m_subWindow)
		glutInitWindowSize(IntialSize*2,IntialSize); 
	else
		glutInitWindowSize(IntialSize,IntialSize); 

	m_window1 = glutCreateWindow("Haptic launch"); 
	glutPositionWindow(IntialPosition,IntialPosition); 

	m_dt.init1();

	glutReshapeFunc(m_reshape1); 
	glutDisplayFunc(m_display1); 
	glutKeyboardFunc(m_keyboard1);
	glutKeyboardUpFunc(m_keyboardUp1);
	glutMouseFunc(m_mouse1);
	glutMotionFunc(m_motion1);
	glutEntryFunc(m_entry1);

	/*glutInitWindowSize(IntialSize,IntialSize); 
	m_window2 = glutCreateWindow("Dual Touch 2"); 
	glutPositionWindow(IntialPosition+IntialSize+IntialMargin,IntialPosition); 

	m_dt.init2();

	glutReshapeFunc(m_reshape2); 
	glutDisplayFunc(m_display2); 
	glutKeyboardFunc(m_keyboard2);
	glutKeyboardUpFunc(m_keyboardUp2);
	glutMouseFunc(m_mouse2);
	glutMotionFunc(m_motion2);
	glutEntryFunc(m_entry2);*/

	//setFullScreen(m_fullScreen);

	//glutTimerFunc(0,m_idle2,0);
	glutIdleFunc(m_idle);
	glutMainLoop(); 
	
}
コード例 #29
0
ファイル: main.cpp プロジェクト: yuchien302/skeleton
int main(int argc, char **argv)
{
	glutInit(&argc, argv);
	int display_mode = GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE;
#ifdef OSX_CORE3
	display_mode |= GLUT_3_2_CORE_PROFILE;
#endif
	glutInitDisplayMode(display_mode);

	glutInitWindowSize(width, height);
	glutInitWindowPosition(0, 0);
	window_id = glutCreateWindow("Assignment");

#ifdef __GLEW_H__
	GLenum err = glewInit();
	if (GLEW_OK != err)
	{
		cerr << "Error: " << glewGetErrorString(err) << endl;
		exit(1);
	}
	cout << "Status: Using GLEW " << glewGetString(GLEW_VERSION) << endl;
#endif

	cout << "Status: Using OpenGL " << glGetString(GL_VERSION) << endl;
	cout << "Status: Using GLSL " << glGetString(GL_SHADING_LANGUAGE_VERSION) << endl;

	working_directory = string(argv[0]).substr(0, string(argv[0]).find_last_of("/\\")) + "/";

	init();
	create_menu();

	glutReshapeFunc(reshapefunc);
	glutDisplayFunc(displayfunc);
	glutIdleFunc(idlefunc);

	glutPassiveMotionFunc(pmotionfunc);
	glutMotionFunc(motionfunc);
	glutMouseFunc(mousefunc);

	glutKeyboardFunc(keydownfunc);
	glutKeyboardUpFunc(keyupfunc);

	glutMainLoop();
}
コード例 #30
0
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp, int posX, int posY, bool showWindow) {
    
	gDemoApplication = demoApp;

	glutInit(&argc, argv);
    //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
    glutInitWindowPosition(posX, posY);
    glutInitWindowSize(width, height);
    glutCreateWindow(title);
#ifdef BT_USE_FREEGLUT
	glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif

    gDemoApplication->myinit();

	glutKeyboardFunc(glutKeyboardCallback);
	glutKeyboardUpFunc(glutKeyboardUpCallback);
	glutSpecialFunc(glutSpecialKeyboardCallback);
	glutSpecialUpFunc(glutSpecialKeyboardUpCallback);

	glutReshapeFunc(glutReshapeCallback);
    //createMenu();
	glutIdleFunc(glutMoveAndDisplayCallback);
	glutMouseFunc(glutMouseFuncCallback);
	glutPassiveMotionFunc(glutMotionFuncCallback);
	glutMotionFunc(glutMotionFuncCallback);
	glutDisplayFunc( glutDisplayCallback );

	glutMoveAndDisplayCallback();

//enable vsync to avoid tearing on Apple (todo: for Windows)

#if defined(__APPLE__) && !defined (VMDMESA)
int swap_interval = 1;
CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#endif

	if (!showWindow) 
		glutHideWindow();
	
    glutMainLoop();
    return 0;
}