title: OpenGL without shaders
body: <p>I have read some tutorials to write the following code.
  The only difference is the original tutorials where using SDL instead of GLEW.</p>
  
  <p>I do not understand what is wrong in this code. It compiles but i do not see the triangle. (the tutorial were not using shaders too)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;GL/glew.h&gt;
  #include &lt;GL/gl.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  
  GLFWwindow* window;
  
  int main(int argc, const char * argv[])
  {
      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);
  
      glewExperimental = true;
      if (glewInit() != GLEW_OK)
      {
          return -1;
      }
  
      glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
      glClearColor(0.0f, 1.0f, 1.0f, 1.0f);
  
      do
      {
          glfwPollEvents();
  
          float vertices[] = {-0.5, -0.5,   0.0, 0.5,   0.5, -0.5};
          glClear(GL_COLOR_BUFFER_BIT);
          glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertices);
          glEnableVertexAttribArray(0);
          glDrawArrays(GL_TRIANGLES, 0, 3);
          glDisableVertexAttribArray(0);
  
          glfwSwapBuffers(window);
      }
      while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &amp;&amp; glfwWindowShouldClose(window) == 0 );
  
      glfwTerminate();
  
      return 0;
  }
  </code></pre>