const char * BURGER_API Burger::DisplayOpenGL::GetErrorString(Word uGLErrorEnum) { const char *pResult = "GL_UNKNOWN_ERROR"; WordPtr uCount = BURGER_ARRAYSIZE(g_GetErrorString); const MessageLookup_t *pLookup = g_GetErrorString; do { if (uGLErrorEnum==pLookup->m_uEnum) { pResult = pLookup->m_pName; break; } ++pLookup; } while (--uCount); return pResult; }
Word BURGER_API Burger::Perforce::Init(void) { Word uResult = 0; if (!m_bFilenameInitialized) { // Let's find the perforce EXE // Check for an environment variable with the directory const char *pAppdirectory = Globals::GetEnvironmentString("PERFORCE"); Word bFilenameInitialized = FALSE; if (pAppdirectory) { m_PerforceFilename.SetFromNative(pAppdirectory); Free(pAppdirectory); m_PerforceFilename.Append("p4.exe"); // Is there an exec here? if (FileManager::DoesFileExist(&m_PerforceFilename)) { bFilenameInitialized = TRUE; } } // Try finding it in the usual installation folder if (!bFilenameInitialized) { pAppdirectory = Globals::GetEnvironmentString("ProgramFiles"); if (pAppdirectory) { m_PerforceFilename.SetFromNative(pAppdirectory); Free(pAppdirectory); m_PerforceFilename.Append("Perforce:p4.exe"); if (FileManager::DoesFileExist(&m_PerforceFilename)) { bFilenameInitialized = TRUE; } } } // Fooey. Ask windows if it can find it if (!bFilenameInitialized) { Word16 Output[2048]; if (Globals::PathSearchAndQualifyW(reinterpret_cast<const Word16 *>(L"p4.exe"),Output,BURGER_ARRAYSIZE(Output))) { pAppdirectory = UTF8::FromUTF16(Output); m_PerforceFilename.SetFromNative(pAppdirectory); Free(pAppdirectory); if (FileManager::DoesFileExist(&m_PerforceFilename)) { bFilenameInitialized = TRUE; } } } m_bFilenameInitialized = bFilenameInitialized; if (!bFilenameInitialized) { uResult = 10; } } return uResult; }
void BURGER_API Burger::DisplayOpenGL::SetupOpenGL(void) { #if defined(GL_SUPPORTED) const char *pString; #if defined(_DEBUG) // For debug version, dump out OpenGL strings to the console // or logfile.txt { WordPtr uCount = BURGER_ARRAYSIZE(g_StringIndexes); const GLStringIndex_t *pWork = g_StringIndexes; do { // Get the string for the enumeration pString = reinterpret_cast<const char *>(glGetString(pWork->m_eEnum)); // If supported, print it if (pString) { Debug::Message("%s = ",pWork->m_pName); // Use String() because pResult can be long enough to overrun the buffer Debug::String(pString); Debug::String("\n"); } ++pWork; } while (--uCount); } #endif // // Obtain the version of OpenGL found // float fVersion = 0.0f; pString = reinterpret_cast<const char *>(glGetString(GL_VERSION)); if (pString) { if (!MemoryCompare("OpenGL ES ",pString,10)) { pString += 10; } fVersion = AsciiToFloat(pString); } m_fOpenGLVersion = fVersion; // // Obtain the version of the OpenGL shader compiler // fVersion = 0.0f; pString = reinterpret_cast<const char *>(glGetString(GL_SHADING_LANGUAGE_VERSION)); if (pString) { if (!MemoryCompare("OpenGL ES GLSL ES ",pString,18)) { pString += 18; } fVersion = AsciiToFloat(pString); } m_fShadingLanguageVersion = fVersion; // // Obtain the supported compressed texture types // Free(m_pCompressedFormats); m_pCompressedFormats = NULL; Word uTemp = 0; GLint iTemp = 0; glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB,&iTemp); #if defined(_DEBUG) Debug::Message("GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = %i\n",iTemp); #endif if (iTemp) { GLint iTemp2 = iTemp; GLint *pBuffer = static_cast<GLint *>(Alloc(sizeof(GLint)*iTemp2)); if (pBuffer) { glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB,pBuffer); uTemp = static_cast<Word>(iTemp); m_pCompressedFormats = reinterpret_cast<Word *>(pBuffer); // Dump the list on debug builds #if defined(_DEBUG) do { Debug::Message("OpenGL supported compressed format 0x%04X\n",pBuffer[0]); ++pBuffer; } while (--iTemp2); #endif } } m_uCompressedFormatCount = uTemp; #endif }