总结:程序调试过程中,把日志打印出来是个不错的调试方法:
//! Print the log info to console;
static void log( std::string strLog)
{
#ifdef _DEBUG_LOG_PRINT
cout << strLog << endl;
//! Write the debug log in file(debug.log);
fstream fs("./debug.log", ios::app);
fs << strLog << endl;
fs.close();
#endif
}
//! Print the opengl and glsl's version information;
static void TEGlVersionInfo(void)
{
const GLubyte* byteGlVersion = glGetString(GL_VERSION);
const GLubyte* byteGlVendor = glGetString(GL_VENDOR);
const GLubyte* byteGlRenderer = glGetString(GL_RENDERER);
const GLubyte* byteSLVersion = glGetString(GL_SHADING_LANGUAGE_VERSION);
std::string strTemp = "OpenGL version: ";
strTemp += TE::numToString(byteGlVersion);
TE::log(strTemp);
strTemp = "GL_VENDOR: ";
strTemp += TE::numToString(byteGlVendor);
TE::log(strTemp);
strTemp = "GL_RENDERER: ";
strTemp += TE::numToString(byteGlRenderer);
TE::log(strTemp);
strTemp = "GLSL version: ";
strTemp += TE::numToString(byteSLVersion);
TE::log(strTemp);
}