Как использовать новые версии GLSL на mac?

Пишу приложение на OpenGL. Удалось создать контекст версии 4.1. Но шейдеры поддерживаются только версии 150. При попытке использования любой другой версии возникает ошибка ERROR: Compiled vertex shader was corrupt. ERROR: Compiled fragment shader was corrupt. Мне нужна версия 320 и новее. Почему шейдеры версии 150 компилируются при использовании OpenGL 4.1? Разве нужна не 410 версия?

Xcode 10.3, macOS 10.14.6 Mojave, MacBook Pro 13 2018 iris graphics plus 655. Пишу на c++

Код шейдеров:

main.glslv

#version 150 core

layout (location = 0) in vec3 v_position;
layout (location = 1) in vec2 v_texCoord;
layout (location = 2) in vec4 v_light;
layout (location = 4) in vec4 v_color;

out vec4 a_color;
out vec2 a_texCoord;

uniform mat4 model;
uniform mat4 projview;

void main(){
    vec4 position = projview * model * vec4(v_position, 1.0);
    a_color = vec4(v_light.r,v_light.g,v_light.b,1.0f);
    a_texCoord = v_texCoord;
    a_color.rgb += v_light.a;
    a_color.rgb *= 1.0-position.z*0.0025;
    //a_color.rgb = pow(a_color.rgb, vec3(1.0/0.7));
    gl_Position = position;
}

main.glslf

#version 150 core

in vec4 a_color;
in vec2 a_texCoord;
out vec4 f_color;

uniform sampler2D u_texture0;

void main(){
    vec4 tex_color = texture(u_texture0, a_texCoord);
    if (tex_color.a < 0.5)
    discard;
    f_color = a_color * tex_color;
}

Участок кода с инициализацией GLFW

Window.cpp

int Window::initialize(int width, int height, const char* title){
if(!glfwInit()){
    std::cerr << "Error: failed init glfw" << std::endl;
    return -1;
}

//print glfw errors
glfwSetErrorCallback(error_callback);

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

window = glfwCreateWindow(width, height, title, nullptr, nullptr);

if (window == nullptr){
    std::cerr << "Failed to create GLFW Window" << std::endl;
    glfwTerminate();
    return -1;
}

//glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
//glfwWindowHint(GLFW_SAMPLES, 2);


#ifdef __APPLE__
    std::cout << "This is Mac" << std::endl;
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

#endif
    //OpenGL version
    unsigned int major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
    unsigned int minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);

    std::cerr << "OpenGL shader version: " << major << "." << minor << std::endl; //4.1

    glfwMakeContextCurrent(window);

    std::cerr << "OpenGL version: " << glGetString(GL_VERSION) << std::endl; //4.1 INTEL-12.10.12


    glViewport(0,0, width, height);

    Window::width = width;
    Window::height = height;
    return 0;
}

Ответы (0 шт):