user3817833
user3817833

Reputation: 97

How do I create an OpenGL 1.2 context in GLFW 3

I want to create OpenGL 1.2 context, but I get this error: "Failed to open GLFW window". When I create 3.3 or 4.3 context there is no problem. How can I create 1.2 context?

glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
WindowWidth = mode->width;
WindowHeight = mode->height;
midWindowWidth = WindowWidth / 2;
midWindowHeight = WindowHeight / 2;



window = glfwCreateWindow(WindowWidth, WindowHeight, "Quadcopter Project", glfwGetPrimaryMonitor(), NULL);
if( window == NULL )
{
    fprintf( stderr, "Failed to open GLFW window. \n" );
    glfwTerminate();
    return -1;
}

Upvotes: 1

Views: 1619

Answers (1)

derhass
derhass

Reputation: 45352

There are no profiles in OpenGL < 3.2. You cannot create a 1.2 core profile because there is no such thing.

You allso cannot directly force the driver to create a 1.2 context. The afunctionality to request a specific context version was introduced in 3.0. So basically, everything before 3.0 is just some legacy context. You can ask for 1.2, but it might give you a much higher (compatibility profile) context, depending on the platform and the drivers you try this on.

Upvotes: 3

Related Questions