glad OpenGL loader generator
Justin Whear
justin at economicmodeling.com
Mon Aug 5 15:33:35 PDT 2013
On Tue, 06 Aug 2013 00:21:46 +0200, David wrote:
> I was thinking of that, too, but caching the OpenGL call to
> glGetStringi, I don't think you can prevent the linear searches.
Why not something like this for the GL_VERSION >= 3 codepath in has_ext?
-----------------------------------
static auto availableExts;
if (availableExts.empty)
{
int num;
glGetIntegerv(GL_NUM_EXTENSIONS, &num);
availableExts = new string[](num);
foreach (i, ref extName; availableExts)
extName = (cast(const(char)*)glGetStringi(GL_EXTENSIONS, i)).idup;
availableExts.sort();
}
// Use binary search
return assumeSorted(availableExts).contains(ext);
-----------------------------------
More information about the Digitalmars-d-announce
mailing list