MAC OpenGL shader error: “version '150' is not supported ”

后端 未结 3 563
长发绾君心
长发绾君心 2021-01-28 12:45

I follow the book \"OpenGL SuperBible 5th Edition\" to study openGL, the capture 6th demo to create shader by hand all not work. Like the demo of \"ShadedTriangle\", to create

相关标签:
3条回答
  • 2021-01-28 13:16

    1.50 requires OpenGL 3.2 support. Unless you can get a newer driver (or a GPU), I think you're out of luck on this one.

    0 讨论(0)
  • 2021-01-28 13:23

    On Mac you need to tell OpenGL which version to use before creating the window.

    This answer explains how to do it with GLFW:

    I'm still searching for a way to do this with GLUT.

    something like this:

    glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4)
    glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 1)
    glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, GL_TRUE)
    glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
    window = glfw.create_window(800,600,"My OpenGL Window", None, None)
    
    0 讨论(0)
  • 2021-01-28 13:27

    macOS' system GLUT does not have the capability of creating an OpenGL 3+ context.

    FreeGLUT provides a way to do it, taken from here:

    glutInitContextVersion(3,2); /* or later versions, core was introduced only with 3.2 */
    glutInitContextProfile(GLUT_CORE_PROFILE);
    

    Or you can take @izzy's advice and use GLFW.

    0 讨论(0)
提交回复
热议问题