title: glewInit() Fail and OpenGL error 1282
body: <p>I have a very very basic OpenGL program using glfw3 for window stuff.</p>
  
  <p>Here is my main:</p>
  
  <pre><code>//Headers
  #include &lt;GL\glew.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  #include "Utils.h"
  
  
  
  //Function Prototypes
  void setupEvents(GLFWwindow* window);
  
  
  //Main function
  int main(void)
  {
      GLFWwindow* window;
      if (!glfwInit())    exit(EXIT_FAILURE);
  
      window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
      glewExperimental = GL_FALSE;
      GLenum error = glGetError();
  
      if (error != GL_NO_ERROR)
      {
          std::cout &lt;&lt; "OpenGL Error: " &lt;&lt; error &lt;&lt; std::endl;
      }
      GLenum glewinit = glewInit();
      if (glewinit != GLEW_OK) {
          std::cout &lt;&lt; "Glew not okay! " &lt;&lt; glewinit;
          exit(EXIT_FAILURE);
      }
      if (!window){   glfwTerminate();    exit(EXIT_FAILURE); } //Failed to create window
  
      //Make our window current
      glfwMakeContextCurrent(window);
      setupEvents(window);
  
      //Let's make our program
      //GLuint glProgram = LoadShaders("../Shaders/Section_1/Basic.vert", "../Shaders/Section_1/Basic.frag");
      GLuint glProgram = LoadShaders("Basic.vert", "Basic.frag");
  
      while (!glfwWindowShouldClose(window))
      {
          glClear(GL_COLOR_BUFFER_BIT);
  
          //Swap buffers and call events.
          glfwSwapBuffers(window);
          glfwPollEvents();
      }
  
  
  
      //Destory our window and exit glfw.
      glfwDestroyWindow(window); 
      glfwTerminate();
      exit(EXIT_SUCCESS);
  }
  
  static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
  {
      //The key callback
      if (key == GLFW_KEY_ESCAPE &amp;&amp; action == GLFW_PRESS)
          glfwSetWindowShouldClose(window, GL_TRUE);
  }
  
  void setupEvents(GLFWwindow* window) {
      //Setup our events.
      glfwSetKeyCallback(window, key_callback);
  } 
  </code></pre>
  
  <p>Utils:</p>
  
  <pre><code>#include &lt;GL\glew.h&gt;
  #include &lt;glm/glm.hpp&gt;
  #include &lt;fstream&gt; 
  #include &lt;vector&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;algorithm&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  GLuint LoadShaders(const char * vertex_file_path, const char * fragment_file_path){
  
      // Create the shaders
      GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
      GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
  
      // Read the Vertex Shader code from the file
      std::string VertexShaderCode;
      std::ifstream VertexShaderStream(vertex_file_path, std::ios::in);
      if (VertexShaderStream.is_open())
      {
          std::string Line = "";
          while (getline(VertexShaderStream, Line))
              VertexShaderCode += "\n" + Line;
          VertexShaderStream.close();
      }
  
      // Read the Fragment Shader code from the file
      std::string FragmentShaderCode;
      std::ifstream FragmentShaderStream(fragment_file_path, std::ios::in);
      if (FragmentShaderStream.is_open()){
          std::string Line = "";
          while (getline(FragmentShaderStream, Line))
              FragmentShaderCode += "\n" + Line;
          FragmentShaderStream.close();
      }
  
      GLint Result = GL_FALSE;
      int InfoLogLength;
  
      // Compile Vertex Shader
      printf("Compiling shader : %s\n", vertex_file_path);
      char const * VertexSourcePointer = VertexShaderCode.c_str();
      glShaderSource(VertexShaderID, 1, &amp;VertexSourcePointer, NULL);
      glCompileShader(VertexShaderID);
  
      // Check Vertex Shader
      glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &amp;Result);
      glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &amp;InfoLogLength);
      std::vector&lt;char&gt; VertexShaderErrorMessage(InfoLogLength);
      glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &amp;VertexShaderErrorMessage[0]);
      fprintf(stdout, "%s\n", &amp;VertexShaderErrorMessage[0]);
  
      // Compile Fragment Shader
      printf("Compiling shader : %s\n", fragment_file_path);
      char const * FragmentSourcePointer = FragmentShaderCode.c_str();
      glShaderSource(FragmentShaderID, 1, &amp;FragmentSourcePointer, NULL);
      glCompileShader(FragmentShaderID);
  
      // Check Fragment Shader
      glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &amp;Result);
      glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &amp;InfoLogLength);
      std::vector&lt;char&gt; FragmentShaderErrorMessage(InfoLogLength);
      glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &amp;FragmentShaderErrorMessage[0]);
      fprintf(stdout, "%s\n", &amp;FragmentShaderErrorMessage[0]);
  
      // Link the program
      fprintf(stdout, "Linking program\n");
      GLuint ProgramID = glCreateProgram();
      glAttachShader(ProgramID, VertexShaderID);
      glAttachShader(ProgramID, FragmentShaderID);
      glLinkProgram(ProgramID);
  
      // Check the program
      glGetProgramiv(ProgramID, GL_LINK_STATUS, &amp;Result);
      glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &amp;InfoLogLength);
      std::vector&lt;char&gt; ProgramErrorMessage(max(InfoLogLength, int(1)));
      glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &amp;ProgramErrorMessage[0]);
      fprintf(stdout, "%s\n", &amp;ProgramErrorMessage[0]);
  
      glDeleteShader(VertexShaderID);
      glDeleteShader(FragmentShaderID);
  
      return ProgramID;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>OpenGL Error: 1282
  Glew not okay! 1
  </code></pre>
  
  <p>I really have no idea what I'm doing wrong.</p>