00001 #include "info.h" 00002 00016 #include <glt/gl.h> 00017 #include <glt/error.h> 00018 #include <misc/config.h> 00019 00020 #include <iostream> 00021 #include <cstdio> 00022 #include <ctime> 00023 #include <cstring> 00024 using namespace std; 00025 00026 #ifdef GLT_ZLIB 00027 #include <zlib.h> 00028 #endif 00029 00030 #ifdef GLT_PNG 00031 #include <png.h> 00032 #endif 00033 00035 static string i2string(const int i) 00036 { 00037 char buffer[100]; 00038 sprintf(buffer,"%d",i); 00039 return buffer; 00040 } 00041 00042 string GltInfo() 00043 { 00044 string str; 00045 00046 GLERROR; 00047 00048 str += " Vendor : "; 00049 str += (char *) glGetString(GL_VENDOR); 00050 str += '\n'; 00051 00052 str += " Renderer : "; 00053 str += (char *) glGetString(GL_RENDERER); 00054 str += '\n'; 00055 00056 str += " Version : "; 00057 str += (char *) glGetString(GL_VERSION); 00058 str += '\n'; 00059 00060 GLint doubleBuffering; 00061 GLint rgbaMode; 00062 GLint zDepth; 00063 GLint stencilDepth; 00064 00065 glGetIntegerv(GL_DOUBLEBUFFER,&doubleBuffering); 00066 glGetIntegerv(GL_RGBA_MODE,&rgbaMode); 00067 glGetIntegerv(GL_DEPTH_BITS,&zDepth); 00068 glGetIntegerv(GL_STENCIL_BITS,&stencilDepth); 00069 00070 GLERROR 00071 00072 str += "Double-buffering : "; 00073 str += (doubleBuffering ? "" : "not " ); 00074 str += "supported.\n"; 00075 00076 str += " RGBA mode : "; 00077 str += (rgbaMode ? "" : "not " ); 00078 str += "enabled.\n"; 00079 00080 str += " Depth buffer : "; 00081 str += i2string(zDepth); 00082 str += " bit-planes.\n"; 00083 00084 str += " Stencil buffer : "; 00085 str += i2string(stencilDepth); 00086 str += " bit-planes."; 00087 00088 return str; 00089 } 00090 00091 string GltDate() 00092 { 00093 time_t clock; 00094 time(&clock); 00095 return asctime(localtime(&clock)); 00096 } 00097 00098 string GltVersion() 00099 { 00100 return GLT_VERSION_STRING; 00101 } 00102 00103 string GltVersionInformation() 00104 { 00105 string str; 00106 00107 str += "GLT " + GltVersion() + "\n"; 00108 00109 #ifdef GLT_ZLIB 00110 str += "zLib " + string(ZLIB_VERSION) + "\n"; 00111 #endif 00112 00113 #ifdef GLT_PNG 00114 str += "libPNG " + string(PNG_LIBPNG_VER_STRING) + "\n"; 00115 #endif 00116 00117 return str; 00118 }