コード例 #1
0
ファイル: elso.cpp プロジェクト: dukkona/Grafika
int main(int argc, char **argv) {
  glutInit(&argc, argv);
  glutInitWindowSize(600, 600);
  glutInitWindowPosition(100, 100);
  glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);

  glutCreateWindow("Grafika pelda program");

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();

  onInitialization();

  glutDisplayFunc(onDisplay);
  glutMouseFunc(onMouse);
  glutIdleFunc(onIdle);
  glutKeyboardFunc(onKeyboard);
  glutKeyboardUpFunc(onKeyboardUp);
  glutMotionFunc(onMouseMotion);

  glutMainLoop();

  return 0;
}
コード例 #2
0
ファイル: jegyzet.cpp プロジェクト: tht-krisztian/Grafika
// A C++ program belepesi pontja, a main fuggvenyt mar nem szabad bantani
int main(int argc, char **argv) {
    glutInit(&argc, argv); 				// GLUT inicializalasa
    glutInitWindowSize(600, 600);			// Alkalmazas ablak kezdeti merete 600x600 pixel 
    glutInitWindowPosition(100, 100);			// Az elozo alkalmazas ablakhoz kepest hol tunik fel
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);	// 8 bites R,G,B,A + dupla buffer + melyseg buffer

    glutCreateWindow("Grafika hazi feladat");		// Alkalmazas ablak megszuletik es megjelenik a kepernyon

    glMatrixMode(GL_MODELVIEW);				// A MODELVIEW transzformaciot egysegmatrixra inicializaljuk
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);			// A PROJECTION transzformaciot egysegmatrixra inicializaljuk
    glLoadIdentity();

    onInitialization();					// Az altalad irt inicializalast lefuttatjuk

    glutDisplayFunc(onDisplay);				// Esemenykezelok regisztralasa
    glutMouseFunc(onMouse); 
    glutIdleFunc(onIdle);
    glutKeyboardFunc(onKeyboard);
    glutKeyboardUpFunc(onKeyboardUp);
    glutMotionFunc(onMouseMotion);

    glutMainLoop();					// Esemenykezelo hurok
    
    return 0;
}
コード例 #3
0
ファイル: FirstGpgpu.cpp プロジェクト: DerDolch/unrimp
/**
*  @brief
*    Run the application
*/
int FirstGpgpu::run()
{
	// Create an instance of a renderer application on the C runtime stack
	// -> We only use this instance in order to create and manage the renderer instance easily in this example
	ApplicationRenderer applicationRenderer(mRendererName);

	// Get the renderer instance and ensure it's valid
	mRenderer = applicationRenderer.getRenderer();
	if (nullptr != mRenderer)
	{
		// Call initialization method
		onInitialization();

		// Let the application to it's job
		onDoJob();

		// Call de-initialization method
		onDeinitialization();

		// Release our renderer reference
		mRenderer = nullptr;
	}

	// Done, no error
	return 0;
}
コード例 #4
0
ファイル: main.cpp プロジェクト: davll/ICG_SSAO
int main(int argc, char** argv){
  glutInit(&argc, argv);
  
#if defined(OS_MAC)
  {
    char* p = strrchr(argv[0], '/');
    *p = 0;
    chdir(argv[0]);
    //puts(getcwd(NULL, 0));
  }
#endif
#if defined(OS_WIN)
  OutputDebugString(TEXT("Boot up!\n"));
#endif
  
  glutInitWindowPosition(0, 0);
  glutInitWindowSize(1280, 720);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
#if defined(OS_WIN)
  glutCreateWindow_ATEXIT_HACK("ICG SSAO");
#else
  glutCreateWindow("ICG SSAO");
#endif
  
  glutDisplayFunc(onDisplay);
  glutIdleFunc(onIdle);
  glutReshapeFunc(onReshape);
  glutKeyboardFunc(onKeyDown);
  glutSpecialFunc(onSpecialDown);
  glutMotionFunc(onMouseMotion);
  glutPassiveMotionFunc(onMousePassiveMotion);
  
  glewInit();
  
  /* ENABLE V-SYNC */
  int vsync = 1;
#if defined(OS_MAC)
  CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &vsync);
#elif defined(OS_WIN)
  if(WGLEW_EXT_swap_control)
    wglSwapIntervalEXT(vsync);
#else
  if(GLXEW_EXT_swap_control)
    glXSwapIntervalEXT(glXGetCurrentDisplay(), glXGetCurrentDrawable(), vsync);
#endif
  
  onInitialization();
#if !defined(__MINGW32__)
  atexit(onShutdown);
#endif
  
  /* NO RETURN */
  glutMainLoop();
  
  return 0;
}
コード例 #5
0
int IApplication::run()
{
	// Call application implementation initialization method
	mApplicationImpl->onInitialization();
	onInitialization();

	// Main loop - Process OS messages (non-blocking) first
	while (!mApplicationImpl->processMessages())
	{
		// Update the application logic
		onUpdate();

		// Redraw request
		redraw();
	}

	// Call application implementation de-initialization method
	onDeinitialization();
	mApplicationImpl->onDeinitialization();

	// Done, no error
	return 0;
}
コード例 #6
0
int main(int argc, char **argv)
{
	glutInit(&argc, argv);
	glutInitWindowSize(600, 600);
	glutInitWindowPosition(100, 100);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
	glutCreateWindow("Teapot");

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0, 1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	onInitialization();

	glutDisplayFunc(onDisplay);
	glutKeyboardFunc(onKeyboard);

	glutMainLoop();

	return 0;
}
コード例 #7
0
ファイル: FirstGpgpu.cpp プロジェクト: DerDolch/unrimp
		/**
		*  @brief
		*    Constructor
		*
		*  @param[in] rendererName
		*    Case sensitive ASCII name of the renderer to instance, if null pointer or unknown renderer no renderer will be used.
		*    Example renderer names: "Null", "OpenGL", "OpenGLES2", "Direct3D9", "Direct3D10", "Direct3D11"
		*/
		explicit ApplicationRenderer(const char *rendererName) :
			IApplicationRenderer(rendererName)
		{
			// Call application implementation initialization method
			onInitialization();
		}