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;


// Use binary search
return assumeSorted(availableExts).contains(ext);

Reply via email to