// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// bool Pool3dGame::VInitOpenGL() { bool result = true; GF_LOG_DEB("Initializing the GLEW library"); #if TARGET_OS_MAC glewExperimental = GL_TRUE; #endif GLenum res = glewInit(); if (GLEW_OK != res) { // Problem: glewInit failed, something is seriously wrong. GF_LOG_ERR(string("Failed to initialize the GLEW library: ") + string(reinterpret_cast<const char *>(glewGetErrorString(res)))); result = false; } if(result) { GF_LOG_DEB(string("Using GLEW version: ") + string(reinterpret_cast<const char *>(glewGetString(GLEW_VERSION)))); } // Check for required OpenGL extensions here and set application wide flags if certain features are available. // TODO: check for other extensions. #ifdef GLEW_EXT_texture_filter_anisotropic m_isAnisotropicExtPresent = true; #endif // Perform any global OpenGL initialization here. if(result) { // Set the color buffer clear value. glClearColor(GameHalloran::g_gcLightGray.GetX(), GameHalloran::g_gcLightGray.GetY(), GameHalloran::g_gcLightGray.GetZ(), GameHalloran::g_gcLightGray.GetW()); // Enable depth testing. glEnable(GL_DEPTH_TEST); // Set the alpha blending function. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Turn on anitaliasing for lines glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // Cull all back facing triangles. glCullFace(GL_BACK); // Set the triangle winding. glFrontFace(GL_CCW); // Initialize the TextureManager last once all other OpenGL initialization is done. m_texManagerPtr.reset(GCC_NEW TextureManager(10, 1024*1024*20)); m_texManagerPtr->SetTextureFilterMode(TextureManager::eAnisotropic); m_texManagerPtr->SetAnisotropicLinearLevel(1.0f); GameMain::SetupTextureAtlasManager(std::string("atlases") + ZipFile::ZIP_PATH_SEPERATOR + std::string("atlasDictionary.xml")); } return (result); }
bool TestApp::VInitOpenGL() { bool result = true; GF_LOG_DEB("Initializing the GLEW library"); #if defined(TARGET_OS_MAC) glewExperimental = GL_TRUE; #endif GLenum res = glewInit(); if(GLEW_OK != res) { GF_LOG_ERR(string("Failed to initialize the GLEW library: ") + string(reinterpret_cast<const char *>(glewGetErrorString(res)))); result = false; } if(result) { GF_LOG_DEB(string("Using GLEW version: ") + string(reinterpret_cast<const char *>(glewGetString(GLEW_VERSION)))); } #ifdef GLEW_EXT_texture_filter_anisotropic m_isAnisotropicExtPresent = true; #endif if(result) { glClearColor(GameHalloran::g_gcBlue.GetX() , GameHalloran::g_gcBlue.GetY() , GameHalloran::g_gcBlue.GetZ() , GameHalloran::g_gcBlue.GetW()); glEnable(GL_DEPTH_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glCullFace(GL_BACK); glFrontFace(GL_CCW); m_texManagerPtr.reset(GCC_NEW TextureManager(10, 1024 * 1024 * 20)); m_texManagerPtr->SetTextureFilterMode(TextureManager::eAnisotropic); m_texManagerPtr->SetAnisotropicLinearLevel(1.0f); GameMain::SetupTextureAtlasManager(std::string("atlases") + ZipFile::ZIP_PATH_SEPERATOR + std::string("atlasDictionary.xml")); } return (result); }