Retreiving OpenGL Version, and GPU Properties such as VRAM

I am trying to get the current OpenGL Version, and the current GPU’s Total Available VRAM. Is this possible to do in MonoGame without extending the framework? Is there a method to query OpenGL methods such as GL.GetString and GL.GetIntegerv if there isn’t a method of getting system information?

I asked a similar question a year ago and also got no response. I don’t think there’s a way to do it within MonoGame, at least not since SDL was implemented in MG 3.6. You might be able to search out DLLs on the user’s PC to find these values, but that might not be easy to figure out.

Something I just thought of (and haven’t tested), you could try using try/catch blocks to set features like BlendState.IndependentBlendEnable, which are OpenGL 4.0 only. If it works, the machine supports GL 4.0; if it fails, it’s not supported. This is just a theory of course. You will have to get creative to find those values since they seemingly can’t be found through MonoGame.

In OpenGL the GraphicsDevice has two fields

internal int glMajorVersion;
internal int glMinorVersion;

They are internal, so you can’t access them directly, but you can use reflection to retrieve those values.

The OpenGL functions like GetString and GetIntegerv are available as static delegates in MonoGame.OpenGL.GL, but they are also internal.