GLLoad OpenGL 3.3/4+ support issue

I recently converted from using GLEW to GLLoad from the Unofficial SDK - Due to the fact that GLEW doesn’t really support OSX.

GLLoad is now causing a problem when trying to use 3.3 core gl::VertexAttribDivisor which is undefined even on a 4.3 context.

When trying to figure out why I took a look in how GLLoad was implemented inside the LoadFunctions. As far as I can tell the method is suppose to load the various functions specified for each version successively.

LoadFunctions taken from the newest version of GLLoad:

int LoadFunctions()
{
    int eCurrLoadStatus = LS_LOAD_FUNCTIONS_ALL;

    iMajorVersion = 0;
    iMinorVersion = 0;

    //Clear the extensions, in case we loaded already.
    gleIntClear();

    //Get the base functions that we need just to process OpenGL.
    gleIntLoadBaseFuncs();

    //Get the version numbers.
    GetGLVersion(&iMajorVersion, &iMinorVersion);

    if(iMajorVersion < 3)
    {
        //Load the 2.1 core.
        if(!gleIntLoad_Version_2_1()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
    }
    else if(iMajorVersion == 3 && iMinorVersion < 2)
    {
        switch(iMinorVersion)
        {
        case 0:
            if(!gleIntLoad_Version_3_0()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            break;
        case 1:
            //Check the ARB_compatibility extension.
            if(CheckCompatibilityExt())
            {
                if(!gleIntLoad_Version_3_1_Comp()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            }
            else
            {
                if(!gleIntLoad_Version_3_1()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            }
            break;
        }
    }
    else
    {
        int iProfileMask = 0;
        glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &iProfileMask);
        if(iProfileMask)
        {
            if(iProfileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
            {
                if(!gleIntLoad_Version_3_2_Comp()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            }
            else
            {
                if(!gleIntLoad_Version_3_2()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            }
        }
        else
        {
            //Hack to fix NVIDIA stupidity.
            if(CheckCompatibilityExt())
            {
                if(!gleIntLoad_Version_3_2_Comp()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            }
            else
            {
                if(!gleIntLoad_Version_3_2()) eCurrLoadStatus = LS_LOAD_FUNCTIONS_SOME;
            }
        }
    }

    //Now, process the extensions.
    //Use different methods if glGetStringi is available.
    if(iMajorVersion < 3)
    {
        ProcExtFromExtString((const char *)glGetString(GL_EXTENSIONS), gleIntExtensionMap, gleIntExtensionMapSize);
    }
    else
    {
        ProcExtFromList();
    }

    return eCurrLoadStatus;
}

As far as I can tell this doesn’t handle anything past 3.2. Surely this is a bug as calling eg. gleIntLoad_Version_4_3_Comp() makes everything work as intended.

I recently converted from using GLEW to GLLoad from the Unofficial SDK - Due to the fact that GLEW doesn’t really support OSX.

Neither does GLLoad. At least, it doesn’t advertise itself as such.

GLLoad is now causing a problem when trying to use 3.3 core gl::VertexAttribDivisor which is undefined even on a 4.3 context.

You don’t have a 4.3 context; you have 4.3-capable hardware but that’s not the same thing. OSX simply does not support anything higher than 3.2. And glVertexAttribDivisor is a GL 3.3 function; that’s why you’re not getting the function loaded.

If that was the reason you switched, the apparent lack of post-3.2 functions loaded by GLEW, then you’re not going to get them any more with GLLoad than with GLEW. They simply aren’t available.

That being said:

As far as I can tell this doesn’t handle anything past 3.2.

It kinda does. Because 99% of the functions that are exposed in higher versions come from core extensions, they are loaded by the part that loads extension functions.

But you’re right, this is a bug; there will be functions that are missed by this. glVertexAttribDivisor is one of them, but that’s more of a coincidence in your case.

Speaking of bugs, these are best filed on Bitbucket, not this forum.

I’ve updated the SDK to incorporate the fix.

You misunderstood me Alfonse - I DO have a 4.3 context when I’m using my library on windows machines. I’m fully aware of the 3.2 only on OSX. And the problem I was outlining was on a windows machine. GLLoad does work fine on OSX - atleast for now.

I’ve fixed the problem myself but thank you for updating the SDK.

GLLoad does work fine on OSX - atleast for now.

It does? That’s a surprise, though a pleasant one. I don’t have access to MacOSX to test with.