I would like to check the amount of video memory present on the video card. Here is the Visual Basic code that accomplishes this:
Dim controllers As Object
Dim controller As Object
Dim ram As Variant
Dim caption As Variant
Set controllers = GetObject("WinMgmts:").InstancesOf("Win32_VideoController")
MsgBox "Retrieved Win32_VideoController collection."
For Each controller In controllers
caption = controller.caption
If IsNull(ram) Then
MsgBox "Caption returned Null!"
Else
MsgBox "Caption = " & CStr(caption)
End If
ram = controller.AdapterRAM
If IsNull(ram) Then
MsgBox "AdapterRAM returned Null!"
Else
MsgBox "AdapterRAM = " & CStr(ram)
End If
Next
My problem is getting the “controllers” object. I cannot figure out how to do this. I have tried CreateOleObject(), CreateObject(), and GetActiveObject() in various ways and none of them work. How does Visual Basic’s GetObject() work, and how can I create a Delphi version of it?
If you just want a estimation can you use glGetIntegerv(GL_MAX_TEXTURE_SIZE,…)
For a better answer is a texture proxy available. From the red book:
“Example 9-2 demonstrates how to use the texture proxy to find out if there are enough resources to create a 64 × 64 texel
texture with RGBA components with 8 bits of resolution. If this succeeds, then glGetTexLevelParameteriv() stores the
internal format (in this case, GL_RGBA8) into the variable format.
Example 9-2 : Querying Texture Resources with a Texture Proxy
GLint format;
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA8,
64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0,
GL_TEXTURE_INTERNAL_FORMAT, &format);”
I need an estimation rounded to the nearest megabyte, such as 8 MB, 12 MB, or 32 MB. The value should be the amount of RAM present on the hardware, not how much is available for use.