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

后端 未结 3 566
长发绾君心
长发绾君心 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: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)
    

提交回复
热议问题