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!"
MsgBox "Caption = " & CStr(caption)
ram = controller.AdapterRAM
If IsNull(ram) Then
MsgBox "AdapterRAM returned Null!"
MsgBox "AdapterRAM = " & CStr(ram)
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?
Of course, if there is a better way to get the video card RAM size (besides using DX) then I am open to ideas.
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
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA8,
64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
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.
The texture proxy will give you that. See the red book.
I don’t have access to the Red Book. Do you have a link, or would you mind posting the relevant excerpt?