title: How can i know which opengl version is supported by my system
body: <p>Look at this very basic C++ code:</p>
  
  <pre class="lang-cpp prettyprint-override"><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 &lt;&lt; "GL_VERSION: " &lt;&lt; glGetString(GL_VERSION) &lt;&lt; std::endl;
  </code></pre>
  
  <p>I do not understand how i can "detect" max opengl version i can set in the lines:</p>
  
  <pre><code>glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  </code></pre>
  
  <p>This line cannot be placed before <code>glfwMakeContextCurrent</code>:</p>
  
  <pre><code>glGetString(GL_VERSION)
  </code></pre>
  
  <p>So my question is how can i detect the versions of opengl my system supports at the beginning of the program.</p>
  
  <p>Thanks</p>