How to determine which OGL .dll Windows is using?

I’m writing a medical-image (3D data) viewer in C#, with OpenGL serving as the main display. I am using an OGL “front end” that marshalls the OpenGL functionality from the OGL dll via InteropServices. This makes it a lot easier for me to access and implement OGL from my managed code.

The thing is, the code is hard-written to use “opengl32.dll”, which is the default OOB Windows OGL implementation. Many of the systems I’d like to use the app with naturally have vendor-supplied driver suites installed, including their own (better) OGL files (i.e. “nvoglnt.dll”). But these files are variously named, and I’d like the program to default to using the “currently implemented” driver, and only fall back to the Windows driver in the event of errors.

So I’d like to know how, within C# (or even C++) I can poll the OS for which dll it is actually using to implement OGL. I have tried using some DirectX.Direct3D.Manager calls, but it doesn’t access this info. When I view the display driver properties (detail) from the OS, it lists all of the driver components, including the OGL dll. But I can’t for the life of me find out how to get this at runtime. Perhaps in the registry, but I’m unclear as to how to access this, and particularly, in a manner workable on XP, Vista, and 7.

Any ideas?

well unless your setup is particularity odd “opengl32.dll” will work as a gateway to the vendor specific ones, it doesn’t contain any rendering code itself.
use glGetString(GL_VERSION), glGetString(GL_VENDOR) and glGetString(GL_RENDERER) to figure out whats currently active.

But this is a non issue as it already works as you want it to.

As zeoverlord said, you only ever need to access opengl32.dll. This dll forwards you OpenGL calls to the correct driver implementation, which differs between vendors (you are not supposed to touch the driver dlls - and it would be seriously wrong if you tried to do that).

The correct solution is to call glGetString() and obtain the information you need.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.