void displayevent(void) {
    // limpia la escena (ventana)
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    loadSkyBox();
     // inicializa la Matriz de transformación de coordenadas (Matriz del Modelo)
    glLoadIdentity();
    // verfica superficies visibles
    glEnable( GL_DEPTH_TEST );
    
    menuChoise( );

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    
    //Dibujamos los planetas
    sol ( sol_[0],sol_[1],sol_[2] );
    mercurio ( mercurio_[0], mercurio_[1], mercurio_[2] );
    venus ( venus_[0], venus_[1], venus_[2] );
    tierra ( tierra_[0], tierra_[1], tierra_[2] );
    marte ( marte_[0], marte_[1], marte_[2] );
    jupiter ( jupiter_[0], jupiter_[1], jupiter_[2] );
    saturno ( saturno_[0], saturno_[1], saturno_[2] );
    urano ( urano_[0], urano_[1], urano_[2] );
    neptuno ( neptuno_[0], neptuno_[1], neptuno_[2] );
    pluton ( pluton_[0], pluton_[1], pluton_[2] );
    glutSwapBuffers();
}
示例#2
0
文件: gfx.c 项目: allen7575/gravit
int gfxSetResolution() {
    SDL_VideoInfo* videoInfo;

    video.screenW = video.screenWtoApply;
    video.screenH = video.screenHtoApply;

    if (video.screenAA) {

        SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1);
        SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4);

    }

    video.flags = SDL_OPENGL;

    if (video.screenFS)
        video.flags |= SDL_FULLSCREEN;
    else
        video.flags |= SDL_RESIZABLE;
    
    videoInfo = (SDL_VideoInfo*) SDL_GetVideoInfo();
    
    if (!video.screenW || !video.screenH || video.screenFS) {
        video.screenW = videoInfo->current_w;
        video.screenH = videoInfo->current_h;
    }
    
    video.sdlScreen = SDL_SetVideoMode(video.screenW, video.screenH, video.screenBPP, video.flags );
    if (!video.sdlScreen) {
        conAdd(LERR, "SDL_SetVideoMode failed: %s", SDL_GetError());
        return 1;
    }

    glEnable(GL_TEXTURE_2D);

    // need to (re)load textures
    if (!loadFonts())
        return 2;

    if (!loadParticleTexture())
        return 3;

    loadSkyBox();
    
    // not sure if we need to re-attach to new surface
    //if (video.agarStarted == 1) {
    //    if (AG_SetVideoSurfaceSDL(video.sdlScreen) == -1) {
    //        ( conAdd(LERR, "agar error while attaching to resized window: %s", AG_GetError() );
    //    }
    //}

    return 0;
}
示例#3
0
SkyBox::SkyBox(std::vector<const GLchar*> faces)
{
	// Set up skybox VAO
	glGenVertexArrays(1, &skyBoxVAO);
	glGenBuffers(1, &skyBoxVBO);
	glBindVertexArray(skyBoxVAO);
	glBindBuffer(GL_ARRAY_BUFFER, skyBoxVBO);
	glBufferData(GL_ARRAY_BUFFER, sizeof(skyBoxVertices), &skyBoxVertices, GL_STATIC_DRAW);
	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*)0);

	// Load textures
	textureId = loadSkyBox(faces);

	// Single side rendering
	//glEnable(GL_CULL_FACE);
	//glCullFace(GL_BACK);
}