   Getting Graphics Information
  Hello all.I've written an application and its nearing its final stages. One of the things I want to add is a sort of performance checker, i.e. before running the program it will get some system information and set some variables relating to the performance accordingly. So if the system had only 256MB ram it wouldn't load as much data.I have found functions to retreive processer information and memory information, but I am yet to find something that can return information on the graphics available (memory, core speed, mem speed etc).Is there any C functions/library where I can retreive such data? It only needs to be a very basic judge of performance.I'm using Windows XP, Visual Studio 2005, C, OpenGL and GLUT.  So anything that works with these would be fantastic. Thanks for any help.   
  Information on the display device is typically queried through whatever graphics API you're using.  I'm not an OpenGL guy, but I'm pretty sure it has some functions that should get you the information you need (I know Direct3D has them).  If nobody here knows, you may want to ask the OpenGL forum to point you in the right direction.   ;  In OpenGL you can get some information about the video card with the glGetString() function:glGetString(GL_VERSION);// OpenGL VersionglGetString(GL_VENDOR); // Vendor of Video CardglGetString(GL_RENDERER);    // Device being used to Render in OpenGLglGetString(GL_EXTENSIONS);  // space-delimited list of Extensions supported by your video cardOddly enough, these functions seem to return const GLubyte *, which you'll probably have to typecast into something more useful (like a char*).In order to find out about the capabilities of the CPU, use x86 and the CPUID instruction. Here's some really useful code that I wrote from both Intel and AMD documentation:string featureList = "";char cpuVendorID[13], cpuName[49];int highestEax, highestExtEax, features, extFeatures, msrs;__asm {    ; Gets the CPU's Vendor ID    mov   eax, 0    CPUID    mov   DWORD PTR cpuVendorID[0], ebx    mov   DWORD PTR cpuVendorID[4], edx    mov   DWORD PTR cpuVendorID[8], ecx    ; Gets the basic feature list, and determines how much data cpuid can give    mov   highestEax, eax;    mov   eax, 1    CPUID    mov   features, edx    mov   msrs, ecx    mov   eax, 0x80000000    CPUID    mov   highestExtEax, eax}cpuVendorID[12] = '\0';// Populate feature listif(features & 0x00800000) featureList.append(" MMX");if(features & 0x02000000) featureList.append(" SSE");if(features & 0x04000000) featureList.append(" SSE2");if(msrs & 0x00000001) featureList.append(" SSE3");if(msrs & 0x00000200) featureList.append(" SSSE3");if(msrs & 0x00080000) featureList.append(" SSE4.1");if(msrs & 0x00100000) featureList.append(" SSE4.2");// Populate features from AMD extensionsif(highestExtEax >= 0x80000001) {    __asm {   mov   eax, 0x80000001   CPUID   mov   extFeatures, edx    }    if(extFeatures & 0x80000000) featureList.append(" 3dNow");    if(extFeatures & 0x40000000) featureList.append(" 3dNowExt");    if(extFeatures & 0x00400000) featureList.append(" MmxExt");}// Eliminate the preceding space in the stringif(featureList.length() > 0) featureList = featureList.substr(1);// Get the number of processor coresint numCores = 0;if(highestEax >= 0x00000004) {  // using the Intel method    __asm {   mov   ecx, 0   mov   eax, 4   CPUID   mov   numCores, eax   and   numCores, 0xFC000000   shr   numCores, 26    }    numCores++;}if(numCores == 0 && highestExtEax >= 0x80000008) {    __asm {   mov ecx, 0   mov eax, 0x80000008   CPUID   mov   numCores, ecx   and   numCores, 0x000000FF    }    numCores++;}// Get the name of the CPUif(highestExtEax >= 0x80000004) {    __asm {   mov   eax, 0x80000002   CPUID   mov   DWORD PTR cpuName[0], eax   mov   DWORD PTR cpuName[4], ebx   mov   DWORD PTR cpuName[8], ecx   mov   DWORD PTR cpuName[12], edx   mov   eax, 0x80000003   CPUID   mov   DWORD PTR cpuName[16], eax   mov   DWORD PTR cpuName[20], ebx   mov   DWORD PTR cpuName[24], ecx   mov   DWORD PTR cpuName[28], edx   mov   eax, 0x80000004   CPUID   mov   DWORD PTR cpuName[32], eax   mov   DWORD PTR cpuName[36], ebx   mov   DWORD PTR cpuName[40], ecx   mov   DWORD PTR cpuName[44], edx    }    cpuName[48] = '\0'}else {    cpuName[0] = '\0';}This works properly for both AMD and Intel CPUs. Also, because the guts of the code are in assembly, it will work with any OS / implementation (as long as the CPU supports CPUID - but this is universal on PCs).There is more information you can retrieve such as stepping and cache information, but that's for another time.Retrieving info about memory is not universal - there's info for how to do it in Windows here and for Linux by reading the file /proc/meminfo - the first line should be something like "Memtotal:" followed by the size in bytes.Hope this helps!   ;  Thanks Claymore but I'm after more numerical performance figures, something that I can compare far easier that the name of the card.  Does such a thing exist?Thanks   ;  Not really - at least, not in OpenGL.Something that I did in my game engine was to keep a counter of how many triangles I rendered each frame, as well as the frame rate. If you multiply the numbers together, you get the number of triangles / second you can render...and I found this number to be pretty constant for a particular video card, regardless of what I have in the scene.The only other data I keep track of for performance is how many CPUs and at what speed (from my code above).   ;  I've seen a few games run a quick benchmark before setting the graphics mode.  Basically, try a bunch of things, see how well they work, and use that information to determine what you do.  A bit hackish, but possibly more reliable than querying for arbitrary numbers.Cheers,--Brian;Quote:Original post by NairbI've seen a few games run a quick benchmark before setting the graphics mode.  Basically, try a bunch of things, see how well they work, and use that information to determine what you do.  A bit hackish, but possibly more reliable than querying for arbitrary numbers.That's what I was thinking of doing actually because I've done a similar thing for calculating cpu speed.  Do you know of any code for such a benchmark?Thanks.