コード例 #1
0
ファイル: main_file.cpp プロジェクト: kkapitan/Maze
int main(int argc, char** argv) {

	for (int i = 0; i < M.GetLayers(); i++)
	{
		M.Show(i);
		printf("\n");
	}

	current_elevator_i = M.getElevatorI();
	current_elevator_j = M.getElevatorJ();

	fvc = read_obj("flashlight.obj", fv, ftv, fn);

	initGLUT(&argc, argv);
	initGLEW();
	initOpenGL();

	
	glutKeyboardFunc(Movement);
	glutWarpPointer(200, 200);
	glutMotionFunc(MouseActiveMotion);
	glutPassiveMotionFunc(MouseMotion);
	glutMouseFunc(MouseButtons);
	glutMainLoop();

	freeVAO();
	freeVBO();
	cleanShaders();
	return 0;
}
コード例 #2
0
ファイル: Main.cpp プロジェクト: andrepura/NDK-Samples
int main(int argc, char *argv[]) {

	int rc;
	int exit_application = 0;

	initBBSpecific();

	initOpenGL(screen_cxt);

	while (closeApplication == 0) {
		handleEvent();
		render();
	}

	//Stop requesting events from libscreen
	screen_stop_events(screen_cxt);

	//Shut down BPS library for this process
	bps_shutdown();

	//Use utility code to terminate EGL setup
	bbutil_terminate();

	//Destroy libscreen context
	screen_destroy_context(screen_cxt);
	return 0;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: moose-1/OpenGL-Project
int main(int argc, char *argv[]){
	// OpenGL initialization
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_ALPHA);
	// 
	glutInitWindowSize(640,480);
	// 
	glutCreateWindow("OpenGL");
	// 
	initOpenGL();

	GLenum err = glewInit();
	if(GLEW_OK != err){
		printf("Error: %s", glewGetErrorString(err));
	}
	
	// display scene
	glutDisplayFunc(drawScene);	

	// choose function when window reshape
    glutReshapeFunc( reshapeScreen );

	glutKeyboardFunc(keyDown);
	glutKeyboardUpFunc(keyUp);
	
	glutSpecialFunc(specialKeyDown);
	glutSpecialUpFunc(specialKeyUp);

	//Mouse
	glutMouseFunc(mouseFunction);
	glutMainLoop();

	return 0;
}
コード例 #4
0
int main(int argc, char **argv){
  glutInit(&argc,argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  //glutInitWindowSize(750, 500);
  glutInitWindowSize(glutWindowWidth, glutWindowHeight);
  glutInitWindowPosition(100, 100);
  glutCreateWindow("Room Navigator");

  floorPix[0].readBMPFile("FloorWood01.bmp");
  boundaryWallPix[0].readBMPFile("WallBrick02.bmp");
  innerWallPix[0].readBMPFile("WallWood01.bmp");
  doorPix[0].readBMPFile("Door01L.bmp");
  doorPix[1].readBMPFile("Door01R.bmp");

  initOpenGL();

  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutMouseFunc(mouse);
  glutMotionFunc(mouseMotionHandler);
  glutKeyboardFunc(keyboard);
  glutSpecialFunc(functionKeys);
  glutTimerFunc(1000.0 / FPS, timer, 0);
  glutMainLoop();
  return 0;
}
コード例 #5
0
ファイル: Application.cpp プロジェクト: jamesturk/cpp_photon
void Application::createDisplay(uint width, uint height,
                            uint redBits, uint greenBits, uint blueBits,
                            uint alphaBits, uint depthBits, uint stencilBits,
                            DisplayMode mode, const std::string &title)
{
    GLboolean status;
    status = glfwOpenWindow(width, height, redBits, greenBits, blueBits, 
                    alphaBits, depthBits, stencilBits,
                    mode == DISP_FULLSCREEN ? GLFW_FULLSCREEN : GLFW_WINDOW);
    if(status == GL_FALSE)
    {
        throw APIError("Failed to create display.");
    }
    
    // fetch window size (fixes X11 fullscreen bug)
    glfwGetWindowSize(reinterpret_cast<int*>(&displayWidth_), 
                        reinterpret_cast<int*>(&displayHeight_));
    
    glfwSetWindowTitle(title.c_str());  // title is set separately
    
    initOpenGL();
    setOrthoView();
    
    // register the callbacks (after a window is open)
    glfwSetKeyCallback(Application::keyCallback);
    //glfwSetCharCallback(Application::charCallback);
    glfwSetMouseButtonCallback(Application::mouseButtonCallback);
    glfwSetMousePosCallback(Application::mouseMoveCallback);
    glfwSetMouseWheelCallback(Application::mouseWheelCallback);
    
    quit_ = false;
}
コード例 #6
0
ファイル: main.cpp プロジェクト: evilkandybar/Jotun-Engine
int main( void ) {
	if( init() == -1 ) {
		return EXIT_FAILURE;
	}
	initOpenGL();
	initData();

	while( !glfwWindowShouldClose( window ) ) {
		Time::update();
		mainCamera->update();
		mainLight->update();
		draw();
		glfwPollEvents();
	}

	// Close OpenGL window and terminate GLFW
	glfwTerminate();

	delete mainCamera;
	delete mainLight;
	delete diffuse;
	delete depth;
	delete passthrough;
	delete mesh;
	delete texture;

	MeshLoader::clearAll();

	return EXIT_SUCCESS;
}
コード例 #7
0
ファイル: test.cpp プロジェクト: nical/OpenGLES-d
int main()
{
    initOpenGL();
    createWindow(300,300);

    return 0;
}
コード例 #8
0
ファイル: a2.cpp プロジェクト: jaysuhr/ubc_proj
int main(int argc, char *argv[]) {

    // Initialize GLUT and open a window.
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(800, 600);
    glutCreateWindow(argv[0]);
    
    // Register a bunch of callbacks for GLUT events.
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMotionFunc(mouseMove);
    glutMouseFunc(mouseClick);
    glutKeyboardFunc(keyboard);
    
    // Setup OpenGL
    initOpenGL();
    
    // Initialize our robot.
    if (argc > 1) {
        std::vector<Pose> poses;
        readPoseFile(argv[1], poses);
        robot.setPoses(poses);
    }
    
    // Schedule the first animation callback ASAP.
    glutTimerFunc(0, animate, 0);
    
    // Pass control to GLUT.
    glutMainLoop();
    
    // Will never be reached.
    return 0;
}
コード例 #9
0
ファイル: main.cpp プロジェクト: Lefevrest/cs495-group
// Initialize variables and call initalizations for the window and openGL
void init() {
	initWindow();
	initOpenGL();

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
コード例 #10
0
ファイル: main.cpp プロジェクト: quandrei/DragonCity
//init SDL, OpenGL and game stuff here
bool initGame()
{
	//Initialize SDL
    if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
    {
        return false;
    }

    //Create Window
    if( SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_OPENGL ) == NULL )
    {
        return false;
    }

    //Initialize OpenGL
    if( initOpenGL() == false )
    {
        return false;
    }
	
	if (loadContent() == false)
	{
		return false;
	}

    //Set caption
    SDL_WM_SetCaption( "Dragon City", NULL );

	return true;
}
コード例 #11
0
ファイル: main.cpp プロジェクト: eaa3/OpenGLRenderer
int main(int argc, char **argv) {

    glutInit(&argc, argv);

    /*Setting up  The Display
    /    -RGB color model + Alpha Channel = GLUT_RGBA
    */
    glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH | GLUT_DOUBLE );

    //Configure Window Postion
    glutInitWindowPosition(50, 25);

    //Configure Window Size
    glutInitWindowSize(WINDOW_W,WINDOW_H);

    //Create Window
    glutCreateWindow("Hello OpenGL Shaders");


    //Call to the drawing function
    glutDisplayFunc(draw);
    glutIdleFunc(draw);

    glutReshapeFunc(changeSize);
    glutKeyboardFunc(processNormalKeys);
    glutMotionFunc(mouseCallback);

    initOpenGL();
    setShaders();

    // Loop require by OpenGL
    glutMainLoop();
    return 0;
}
コード例 #12
0
ファイル: Viewer.cpp プロジェクト: Arkapravo/OpenNI2
openni::Status SampleViewer::init(int argc, char **argv)
{
	openni::VideoMode videoMode1 = m_depth1.getVideoMode();
	openni::VideoMode videoMode2 = m_depth2.getVideoMode();

	if (videoMode1.getResolutionX() != videoMode2.getResolutionX() ||
		videoMode1.getResolutionY() != videoMode2.getResolutionY())
	{
		printf("Streams need to match resolution.\n");
		return openni::STATUS_ERROR;
	}

	m_width = videoMode1.getResolutionX();
	m_height = videoMode1.getResolutionY();

	m_streams = new openni::VideoStream*[2];
	m_streams[0] = &m_depth1;
	m_streams[1] = &m_depth2;

	// Texture map init
	m_nTexMapX = MIN_CHUNKS_SIZE(m_width, TEXTURE_SIZE);
	m_nTexMapY = MIN_CHUNKS_SIZE(m_height, TEXTURE_SIZE);
	m_pTexMap = new openni::RGB888Pixel[m_nTexMapX * m_nTexMapY];

	return initOpenGL(argc, argv);

}
コード例 #13
0
ファイル: Server.cpp プロジェクト: BSkin/Rune
int Server::initSDL()
{
	SDL_Init(SDL_INIT_EVERYTHING);

	Uint32 windowFlags;

	//if (Settings::getWindowState() == FULLSCREEN)		windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_FULLSCREEN;
	windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI;
	//else if (Settings::getWindowState() == BORDERLESS) windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_BORDERLESS;

	displayWindow = SDL_CreateWindow("Rune Server", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, windowFlags);

	displayContext = SDL_GL_CreateContext(displayWindow);
	SDL_GL_MakeCurrent(displayWindow, displayContext);

	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);

	initOpenGL();
	//resizeWindow(800, 600);

	SDL_SetRelativeMouseMode(SDL_FALSE);

	return 0;
}
コード例 #14
0
ファイル: Graphics.cpp プロジェクト: Agreon/Fallen
    void Graphics::init(int screen_width, int screen_height, const char* windowTitle, const char* iconSrc)
    {
            m_Screen_Width  = screen_width;
            m_Screen_Height = screen_height;

            SDL_Init(SDL_INIT_EVERYTHING);

            if(iconSrc != NULL)
            {
                SDL_Surface* icon = SDL_LoadBMP(iconSrc);
                SDL_SetWindowIcon(m_Window, icon);
            }
            m_Window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, m_Screen_Width, m_Screen_Height, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL );
            
            if(m_Window == NULL)
            {
				Log::write(AL::LOG_ERROR, "GraphicsManager", std::string("Error while creating window: ") + SDL_GetError());
            }
            
            if(windowTitle != NULL)
            {
                SDL_SetWindowTitle(m_Window, windowTitle);
            }

            initOpenGL();
            
			Log::write(AL::LOG_INFORMATION, "GraphicsManager", "Initialized Window and OpenGL.");
    }
コード例 #15
0
void OpenGL::debugOpenGL(int argc,char** argv, GLuint vertexBuffId){
    //Debugging variabes
    spacing = 0.12;
    vertexPos = new float[3 * debugNo * debugNo * debugNo];

    int count = 0;
    for(int i = 0; i < debugNo; i++){
        for(int j = 0; j < debugNo; j++){
            for(int k = 0; k < debugNo; k++){
                vertexPos[3 * count] = (float)i * spacing;
                vertexPos[3 * count + 1] = (float)j * spacing;
                vertexPos[3 * count + 2] = (float)k * spacing;
                count++;
            }
        }
    }
    
    //Initializing opengl
    initOpenGL(argc, argv);

    //Initializing a vertex array and binding it to use it
    glGenBuffers(1, &vertexBuffId);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffId);
    glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*debugNo*debugNo*debugNo, vertexPos, GL_DYNAMIC_DRAW);

    //Setting up the shaders
	setShaders();
    //GLUT main loop
	glutMainLoop();
}
コード例 #16
0
	xdl_int XdevLOpenGLWGL::create(XdevLWindow* window) {

		if(window == NULL) {
			XDEVL_MODULE_ERROR("Parameter invalid.\n");
			return ERR_ERROR;
		}

		m_window = window;
		m_wnd = static_cast<HWND>(m_window->getInternal(XdevLInternalName("WIN32_HWND")));
		if ( m_wnd == NULL) {
			XDEVL_MODULE_ERROR("Get WIN32_HWND failed.\n");
			return ERR_ERROR;
		}

		if (initOpenGL() == ERR_ERROR) {
			XDEVL_MODULE_ERROR("Failed to initialize OpenGL.\n");
			return ERR_ERROR;
		}

		// Set vertical syncronisation.
		setVSync(getVSync());

		// TODO: This shouldn't be done maybe because it changes the initial state of the OpenGL context.
		glClearColor(1.0, 0.0, 0.0, 1.0);
		glClear(GL_COLOR_BUFFER_BIT);
		SwapBuffers(m_DC);

		return ERR_OK;
	}
コード例 #17
0
ファイル: Viewer.cpp プロジェクト: BrainTech/nite2-bindings
openni::Status SampleViewer::init(int argc, char **argv)
{
	openni::VideoMode depthVideoMode;
	openni::VideoMode colorVideoMode;

	if (m_depthStream.isValid() && m_colorStream.isValid())
	{
		depthVideoMode = m_depthStream.getVideoMode();
		colorVideoMode = m_colorStream.getVideoMode();

		int depthWidth = depthVideoMode.getResolutionX();
		int depthHeight = depthVideoMode.getResolutionY();
		int colorWidth = colorVideoMode.getResolutionX();
		int colorHeight = colorVideoMode.getResolutionY();

		if (depthWidth == colorWidth &&
			depthHeight == colorHeight)
		{
			m_width = depthWidth;
			m_height = depthHeight;
		}
		else
		{
			printf("Error - expect color and depth to be in same resolution: D: %dx%d, C: %dx%d\n",
				depthWidth, depthHeight,
				colorWidth, colorHeight);
			return openni::STATUS_ERROR;
		}
	}
	else if (m_depthStream.isValid())
	{
		depthVideoMode = m_depthStream.getVideoMode();
		m_width = depthVideoMode.getResolutionX();
		m_height = depthVideoMode.getResolutionY();
	}
	else if (m_colorStream.isValid())
	{
		colorVideoMode = m_colorStream.getVideoMode();
		m_width = colorVideoMode.getResolutionX();
		m_height = colorVideoMode.getResolutionY();
	}
	else
	{
		printf("Error - expects at least one of the streams to be valid...\n");
		return openni::STATUS_ERROR;
	}

	m_streams = new openni::VideoStream*[2];
	m_streams[0] = &m_depthStream;
	m_streams[1] = &m_colorStream;

	// Texture map init
	m_nTexMapX = MIN_CHUNKS_SIZE(m_width, TEXTURE_SIZE);
	m_nTexMapY = MIN_CHUNKS_SIZE(m_height, TEXTURE_SIZE);
	m_pTexMap = new openni::RGB888Pixel[m_nTexMapX * m_nTexMapY];

	return initOpenGL(argc, argv);

}
コード例 #18
0
	xdl_int XdevLOpenGLWGL::reset() {
		shutdown();

		if(initOpenGL() == ERR_ERROR)
			return ERR_ERROR;

		return ERR_OK;
	}
コード例 #19
0
bool AppDelegate::applicationDidFinishLaunching()
{
	initOpenGL();
	initDirector();
	initMultiResolution();
	createAndRunScene();
    return true;
}
コード例 #20
0
int main(int argc, char** argv){
	angle = 0.0f;
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutCreateWindow("Drawing a Tetrahedron");
	initOpenGL();
	glutDisplayFunc(mydisplay);
	glutReshapeFunc(reshape);
	glutTimerFunc(100, processTimer, 10);
	glutMainLoop();
}
コード例 #21
0
ファイル: main.cpp プロジェクト: finajo/cs495
// Initialize variables and call initalizations for the window, openGL, and textures
void init() {
	clockwise = true;
	rotVel = 0.5;
	negRotVel = rotVel * -1.0;

	initFaces();
	initWindow();
	initOpenGL();
	initTextures();
}
コード例 #22
0
ファイル: octree_demo.cpp プロジェクト: rolfrm/epiclib
int main(){
  initOpenGL(400,400);
  init_events();
  
  main_test();
  std::cout << "Testing mem corruption\n";
  int * i = new int[12345];
  delete i;
  std::cout << "OK\n";
  return 0;

}
コード例 #23
0
ファイル: main.cpp プロジェクト: susz456/Opengl-project
int main(int argc, char** argv){
	globalEngine = new Engine();
	globalCamera = new Camera();
	
	initGLUT(&argc, argv);
	initGLEW();
	loadModels();
	
	initOpenGL();
	glutMainLoop();
	return 0;
}
コード例 #24
0
ファイル: Main.cpp プロジェクト: mly/BMW
int main(int argc, char** argv) {

    initOpenGL();
    loadAssets();
	handleInput();
	renderFrame();
    while (window.IsOpened()) {       
		window.Display();
    }
		
    return 0;
}
コード例 #25
0
ファイル: demo.cpp プロジェクト: 3da/Grapher
int main(int argc, char **argv)
{
	initOpenGL();
	initBSGUI();

	createUI();

	runMe();

	shutdownBSGUI();
	SDL_Quit();

	return 0;
}
コード例 #26
0
ファイル: main.cpp プロジェクト: axelerator/Fluid
int main(int argc, char *argv[]) {
    std::cout << "Initializing Effect Master 3000..." << std::endl;

    signal(SIGINT, SignalHandler);

    EffectManager *mgr = EffectManager::getInstance();
    Environment *env = mgr->getEnvironment();
    env->loadConfig("effectmaster.conf");

    if (!createWindow("Effect Master 3000", env->getScreenWidth(), env->getScreenHeight(), env->isFullscreen()) ||
            !initOpenGL(env->getScreenWidth(), env->getScreenHeight())) {
        std::cout << "Error creating window!" << std::endl;
        exit(1);
    }

    GLenum err = glewInit();
    if (GLEW_OK != err) {/* Problem: glewInit failed, something is seriously wrong. */
      std::cout << "Error initializing GLEW: " << glewGetErrorString(err)  << std::endl;
      exit(1);
    }

    int fps = env->getFps();
    int msPerFrame = 1000/fps;
    int passedMS = msPerFrame;
    unsigned int frameStart = 0;
    int rest = 0;

    std::cout << "Initialization done!" << std::endl;

    mgr->init();

    while(!done) {
        passedMS = SDL_GetTicks() - frameStart;
        frameStart = SDL_GetTicks();
        mgr->animate(passedMS);
        mgr->draw();
        SDL_GL_SwapBuffers();
        userInput();
        rest = msPerFrame - (SDL_GetTicks() - frameStart);
        if (rest < 0 )
            rest = 0;
        SDL_Delay(rest);
    }

    std::cout << "Shutting down Effect Master 3000..." << std::endl;
    delete env;
    delete mgr;

    return 0;
}
コード例 #27
0
ファイル: main.cpp プロジェクト: finajo/cs495
// Initialize variables and call initalizations for the window, openGL, and textures
void init() {
	rotX = rotY = rotZ = 0;
	rotAmt = 0.5;

	// Each axis will have no rotation when first initalized.
	AxisRotation tmp = {false, false};
	for( int i = 0; i < 3; i++ ) {
		movingRotation[i] = tmp;
	}
	
	initWindow();
	initOpenGL();
	initTextures();
}
コード例 #28
0
///////////////////////////////////////////////////////////////////////////////
//
// tlb_gui function
//
// author: Shaun Gruenig, Hannah Aker, Kelsey Bellew
//
// description: This is a helper function that initializes the GUI and then
//      calls the function to print the TLB.
//
//
///////////////////////////////////////////////////////////////////////////////
void tlb_gui()
{
    ScreenWidth = 200;
    ScreenHeight = TLB_SIZE * 30;
    glutInit ( & ( *superargc ), ( *superargv ) );
    glutSetOption ( GLUT_ACTION_ON_WINDOW_CLOSE, 
			GLUT_ACTION_CONTINUE_EXECUTION );
    initOpenGL();

    glutDisplayFunc ( draw_tlb );

    glutMainLoop();

}
コード例 #29
0
///////////////////////////////////////////////////////////////////////////////
//
// pt_gui function
//
// author: Shaun Gruenig, Hannah Aker, Kelsey Bellew
//
// description: This is a helper function that initializes the GUI and then
//      calls the function to print the page table.
//
//
///////////////////////////////////////////////////////////////////////////////
void pt_gui()
{
    ScreenWidth = 240;
    ScreenHeight = ptvec.size() / 2 * 30;
    glutInit ( & ( *superargc ), ( *superargv ) );
    glutSetOption ( GLUT_ACTION_ON_WINDOW_CLOSE, 
			GLUT_ACTION_CONTINUE_EXECUTION );
    initOpenGL();

    glutDisplayFunc ( draw_pt );

    glutMainLoop();

}
コード例 #30
0
///////////////////////////////////////////////////////////////////////////////
//
// mem_gui function
//
// author: Shaun Gruenig, Hannah Aker, Kelsey Bellew
//
// description: This is a helper function that initializes the GUI and then
//      calls the function to print the physical memory.
//
//
///////////////////////////////////////////////////////////////////////////////
void mem_gui()
{
    ScreenWidth = 8 * 130;
    ScreenHeight = memvec.size() / 8 * 25;
    glutInit ( & ( *superargc ), ( *superargv ) );
    glutSetOption ( GLUT_ACTION_ON_WINDOW_CLOSE, 
			GLUT_ACTION_CONTINUE_EXECUTION );
    initOpenGL();

    glutDisplayFunc ( draw_mem );

    glutMainLoop();

}