
How to determine if function is available in a specific driver
Posted Saturday, 6 August, 2011 - 22:52 by lkalif inSome of the users of my app get errors like:
System.EntryPointNotFoundException: Unable to find an entry point named 'glGenBuffers' in DLL 'opengl32.dll'.
I try to determine if I can use VBO by doing this in code:
string glExtensions = GL.GetString(StringName.Extensions); RenderSettings.UseVBO = glExtensions.Contains("vertex_buffer_object");
But I still get the same error. Is there a way to test if DLL entrypoints exist on a specific machine without resorting to P/Invoking kernel32 or something not platform idependent?


Comments
Re: How to determine if function is available in a specific ...
It is possible to retrieve the address of an OpenGL function:
However, this will not solve the root of the problem, which is the "vertex_buffer_object" check. This check will be true if the ARB version of the extension is available (GL.Arb.GenBuffers()) rather than the core version (GL.GenBuffers()). The ARB version is more widely supported than the core version, hence the bug reports.
What you need to do is check that OpenGL version is >= 1.5.
Re: How to determine if function is available in a specific ...
Thank you very much for that hint. My code will work fine if VBOs are not supported I just didn't know reliable way of detecting it.
Will something like this work: check if the entry point exists for regular version, if it does use that. If it doesn't try checking if ARB extension is present, and if it's not use immediate mode?
Or is this a bad strategy?
Re: How to determine if function is available in a specific ...
Checking both core and ARB versions would ensure the best compatibility. The best approach would be to check the OpenGL version first (version >= 1.5 guarantees support for the core version), check the ARB extension next (version < 1.5) and use the fallback if neither is present.
Re: How to determine if function is available in a specific ...
I implemented it in that way and it works great. Thanks again!