Take a look at this very simple C ++ code:
if(!glfwInit())
{
return -1;
}
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
if (window==NULL)
{
return -1;
}
glfwMakeContextCurrent(window);
std::cout << "GL_VERSION: " << glGetString(GL_VERSION) << std::endl;
I don’t understand how I can “detect” the max opengl version that I can install in the lines:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
This line cannot be placed before glfwMakeContextCurrent
:
glGetString(GL_VERSION)
So my question is how can I determine the opengl versions that my system supports at the beginning of the program.
thank
source
share