OpenGL ES3 crashing on glVertexAttribDivisor

  c++, glew, glfw, opengl-es

I am using C++ with GLFW and GLEW to render some basic graphics. I am developing a cross-platform app that should run on Windows/Linux and Rasberry Pi. I had to choose OpenGL ES 3.1 version because it is the only one that would allow instancing on Rasberry Pi. This error is happening on my current machine (Windows 10), I am currently not able to check the others.

In app I am initializing windows with OpenGL ES 3.1 context like so:

    if (glfwInit() != GLFW_TRUE) // initializing glfw
        // Throw error

    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); // Setting version to 3.1 and es api
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);

    context = glfwCreateWindow(16, 256, "", NULL, NULL);
    if (context == NULL)
        // Throw error

    if (glewInit()!= GLEW_OK)
        // Throw error

Later in code when I am initializing data for OpenGL rendering when I get to the point where I am calling glVertexAttribDivisor, the program just stops working (crashes without any errors) as GLEW has not loaded this function at all.

    glBindBuffer(GL_ARRAY_BUFFER, dc_vbo);

    for (int i = 1; i < 7; i++)

    int dc_str_size = sizeof(DrawCall);

    glVertexAttribIPointer(1, 1, GL_INT, dc_str_size, (GLvoid *)offsetof(DrawCall, type));
    glVertexAttribPointer(2, 3, GL_UNSIGNED_BYTE, GL_FALSE, dc_str_size, (GLvoid *)offsetof(DrawCall, color));
    for (int i = 0; i < 4; i++)
        glVertexAttribPointer(3 + i, 4, GL_FLOAT, GL_FALSE, dc_str_size, (GLvoid *)(offsetof(DrawCall, data) + sizeof(float) * 4 * i));
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    for (int i = 1; i < 7; i++)
        glVertexAttribDivisor(i, 1); // Crashing on first itteration

Commenting out lines where glVertexAttribDivisor is used fixes the crash problem but I no longer am able to get any output. I have triple-checked that glVertexAttribDivisor should come with OpenGL ES 3.0. Also checked that glfw is creating the actually right context by calling glString(GL_VERSION) which outputs: OpenGL ES 3.2 NVIDIA 426.00.

So am I something missing?

Source: Windows Questions C++