Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Force OpenGL 2.1 context

Using GLFW
2014-06-04
2014-06-04
  • mariojmartin
    mariojmartin
    2014-06-04

    Hi, I have the opposite problem for creating the OpenGL context.
    I am developing an application that may have to work with old systems, so I am trying to create an OpenGL 2.1 context in my computer, but it always create a greater version.

    I am using this lines with no luck:
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAYOR, 2);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
    GLFWwindow* window = glfwCreateWindow( width, height, title, NULL, NULL );

    Is any way to to force an OpenGL 2.1 render context?

     
  • Camilla Löwy
    Camilla Löwy
    2014-06-04

    Drivers are not required to implement older versions, so if the above doesn't work then no. What you can do is use a modern extension loader that lets you generate a loader for 2.1 only, and then explicitly set the GLSL version in each shader. That'll get you most of the way.

     
  • mariojmartin
    mariojmartin
    2014-06-04

    Thanks for the explanation.
    I have tinkered a little and have found a workaround myself.

    My laptop has both an INTEL Graphics and an NVIDIA graphic card. It seems that by default, applications use the INTEL's chip. By going into the NVIDIA's control panel and change the configuration and explicit the application to be launched using the NVIDIA's graphic card, the drivers now allow me to create an OpenGl 2.1 context.

     
    Last edit: mariojmartin 2014-06-04
  • Camilla Löwy
    Camilla Löwy
    2014-06-04

    GLFW has a compile-time option for that.