Exemple #1
0
DRReturn load()
{
    if(EnInit_INI("data/config.ini"))
        LOG_ERROR("Fehler bei init OpenGL", DR_ERROR);
    SDL_ShowCursor(true);
    DRRandom::seedf(time(NULL));
    SpriteManager::Instance().init();
    DRFileManager::Instance().addOrdner("data");
    DRFileManager::Instance().addOrdner("data/img");
    DRFileManager::Instance().addOrdner("data/img/wesen");
    return DR_OK;
}
Exemple #2
0
DRReturn load()
{
    if(EnInit_Simple())
        return DR_ERROR;
    DRFileManager::Instance().addOrdner("data/blockView");
    DRFileManager::Instance().addOrdner("data/shader");
    test();
    sizeOfClasses();
    
    //Steuerung
    u16 i = 0;
    gControlModes[i++] = ControlMode(Unit(20, M), 120.0f);
    gControlModes[i++] = ControlMode(Unit(0.100, KM), 100.0f);
    gControlModes[i++] = ControlMode(Unit(10, KM), 80.0f);
    gControlModes[i++] = ControlMode(Unit(100, KM), 60.0f);
    gControlModes[i++] = ControlMode(Unit(1000, KM), 30.0f);
    gControlModes[i++] = ControlMode(Unit(20000, KM), 10.0f);
    gControlModes[i++] = ControlMode(Unit(400000, KM), 4.0f);
    gControlModes[i++] = ControlMode(Unit(0.1, AE), 1.0f);
    gControlModes[i++] = ControlMode(Unit(1, AE), 1.0f);
    //gControlModes[i++] = ControlMode(Unit(10, AE), 1.0f);
    gControlModes[i++] = ControlMode(Unit(500, AE), 1.0f);
     
    //if(EnInit_OpenGL(1.0f, DRVideoConfig(800, 600), "Space Craft - Techdemo"))
    if(EnInit_INI("data/config.ini"))
        LOG_ERROR("Fehler bei init OpenGL", DR_ERROR);       
	LOG_WARNING_SDL();
    
    //check maximal multitextures
    int textureCount = 0;
    glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &textureCount);
    if(textureCount < 4) LOG_ERROR("Multitexturing mit mindestens 4 Texturen wird nicht unterstuetzt!", DR_ERROR);
    DREngineLog.writeToLog("Multitexturing supported up to: %d textures\n", textureCount);
    
    g_Font = new DRFont();
    g_Font->init("data/MalgunGothic.tga", "data/MalgunGothic.tbf");

    DREngineLog.writeToLog("CPU-Count: %d", g_CPU_Count);   
    
    
    
  //  glShadeModel(GL_SMOOTH);
  //  glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
   // glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations

    //Reseten der Matrixen
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    gluPerspective(40.0f, (GLfloat)XWIDTH/(GLfloat)YHEIGHT, 0.1f, 2000.0f);
    glMatrixMode(GL_MODELVIEW);          // Select the modelview matrix

    glLoadIdentity();                    // Reset (init) the modelview matrix


    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    glShadeModel(GL_SMOOTH);             // Enable smooth shading
    glClearDepth(1.0f);                  // Clear depth buffer
    glEnable(GL_DEPTH_TEST);             // Enables depth test
    glDepthFunc(GL_LEQUAL);              // Type of depth test to perform

    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    glLineWidth(1.0f);
    glEnable(GL_NORMALIZE);

    // Enhances image quality
    glColor3f(0.5f, 0.5f, 1.0f);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glDisable(GL_LIGHTING);
    //glEnable(GL_LIGHTING);
    glDisable(GL_FOG);
    
	if(GlobalRenderer::getSingleton().init("data/config.ini"))
		LOG_ERROR("error by init GlobalRenderer", DR_ERROR);
    
    if(ShaderManager::getSingleton().init())
        LOG_ERROR("error by init ShaderManager", DR_ERROR);
    if(DRGeometrieManager::getSingleton().init())
        LOG_ERROR("error by init DRGeometrieManager", DR_ERROR);

    if(g_Player.init())
        LOG_ERROR("Fehler bei Player::init", DR_ERROR);
    g_cam = g_Player.getCamera();
       
    if(g_RenderBlockLoader.init())
        LOG_ERROR("Fehler bei RenderBloockLoader::init", DR_ERROR);
    
    Uint32 start = SDL_GetTicks();
    //g_terrain = new DRTextur("data/terrainsurface.bmp", GL_NEAREST, GL_NEAREST);
    DREngineLog.writeToLog("%.0f Sekunden fuer Planeten laden/generieren", ((float)SDL_GetTicks()-start)/1000.0f);

    return DR_OK;
}