title: Multiple objects fail to render?
body: <p>My should display two squares on the screen but when I run it all I see is a screen of nothingness.</p>
  
  <pre><code>#include &lt;GL/glew.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  #include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  
  
  
  
  struct Shaderprogramsource
  {
  std::string VertexSouce;
  std::string FragmentSource;
  };
  
  static Shaderprogramsource Parseshader(const std::string&amp; filepath)
  {
  std::ifstream stream(filepath);
  
  enum class Shadertype
  {
      VERTEX = 0,
      FRAGMENT = 1,
      NONE = 5
  };
  
  std::string line;
  std::stringstream ss[3];
  
  Shadertype type = Shadertype::NONE;
  
  while (getline(stream, line))
  {
      if (line.find("#shader") != std::string::npos)
      {
          if (line.find("vertex") != std::string::npos)
              type = Shadertype::VERTEX;
  
          else if (line.find("fragment") != std::string::npos)
              type = Shadertype::FRAGMENT;
      }
      else
      {
          ss[(int)type] &lt;&lt; line &lt;&lt; "\n";
      }
  }
  
  return Shaderprogramsource{ ss[0].str(), ss[1].str() };
  }
  
  static int CompileShader(unsigned int type, const std::string&amp; Source)
  {
  unsigned int id = glCreateShader(type);
  const char* src = Source.c_str();
  glShaderSource(id, 1, &amp;src, nullptr);
  glCompileShader(id);
  
  int result;
  glGetShaderiv(id, GL_COMPILE_STATUS, &amp;result);
  
  if (result == GL_FALSE)
  {
      int length;
      glGetShaderiv(id, GL_INFO_LOG_LENGTH, &amp;length);
  
      char* message = (char*)alloca(length * sizeof(char));
      glGetShaderInfoLog(id, length, &amp;length, message);
  
      std::cout &lt;&lt; message;
  
      return 0;
  }
  
  return id;
  }
  
  static unsigned int CreateShader(
  const std::string&amp; Vertexshader,
  const std::string&amp; Fragmentshader)
  {
  unsigned int program = glCreateProgram();
  unsigned int vertex = CompileShader(GL_VERTEX_SHADER, Vertexshader);
  unsigned int fragment = CompileShader(GL_FRAGMENT_SHADER, Fragmentshader);
  
  glAttachShader(program, vertex);
  glAttachShader(program, fragment);
  
  glLinkProgram(program);
  glValidateProgram(program);
  
  return program;
  }
  
  int main(void)
  {
  GLFWwindow* window;
  
  /* Initialize the library */
  if (!glfwInit())
      return -1;
  
  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  
  
  
  
  
  
  /* Create a windowed mode window and its OpenGL context */
  window = glfwCreateWindow(800, 800, "Hello World", NULL, NULL);
  if (!window)
  {
      glfwTerminate();
      return -1;
  }
  
  /* Make the window's context current */
  glfwMakeContextCurrent(window);
  
  if (GLEW_OK == glewInit())
  {
  }
  
  float vertices[] = { -0.1, -0.1,
                        0.1, -0.1, 
                        0.1, 0.1, 
                       -0.1, 0.1 };
  
  
  
  float vertices2[] = { -0.1,0.1,
                        0.1, 0.1,
                        0.1, 0.3,
                       -0.1, 0.3 };
  
  
  unsigned int indices[] = {
  
      0, 1, 2,
      2, 3, 0
  
  
  };
  
  unsigned int vao;
  glGenVertexArrays(1, &amp;vao);
  glBindVertexArray(vao);
  
  unsigned int vao2;
  glGenVertexArrays(1, &amp;vao2);
  glBindVertexArray(vao2);
  
  
  unsigned int buffer1;
  
  unsigned int vbo;
  
  glGenBuffers(1, &amp;buffer1);
  glBindBuffer(GL_ARRAY_BUFFER, buffer1);
  glBufferData(GL_ARRAY_BUFFER, 4 * 2 * sizeof(float), vertices, GL_STATIC_DRAW);
  
  glEnableVertexAttribArray(0);
  
  glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
  
  glEnableVertexAttribArray(1);
  
  glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
  
  
  
  glGenBuffers(1, &amp;vbo);
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, 6 * sizeof(unsigned int), indices, GL_STATIC_DRAW);
  
  
  
  
  
  Shaderprogramsource source = Parseshader("res/shaders/Basic.Shader");
  
  unsigned int shader =
      CreateShader(source.VertexSouce, source.FragmentSource);
  
  
  
  
  glUseProgram(shader);
  
  
  int location = glGetUniformLocation(shader, "Color_u");
  if (location &gt; -1) {
      glUniform4f(location, 0.8f, 0.0f, 0.0f, 1.0f);
  
  }
  
  
  
  std::cout &lt;&lt; source.VertexSouce;
  
  glUseProgram(0);
  glBindBuffer(GL_ARRAY_BUFFER, 0);
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  
  /* Loop until the user closes the window */
  while (!glfwWindowShouldClose(window))
  {
      /* Render here */
  
      glClear(GL_COLOR_BUFFER_BIT);
  
      glUseProgram(shader);
      glBindBuffer(GL_ARRAY_BUFFER, vao);
      glBindBuffer(GL_ARRAY_BUFFER, vao2);
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo);
  
  
      glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
  
      glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
  
      glEnableVertexAttribArray(0);
  
      glEnableVertexAttribArray(1);
  
      glUseProgram(shader);
      glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr);
  
      /* Swap front and back buffers */
      glfwSwapBuffers(window);
  
      /* Poll for and process events */
      glfwPollEvents();
  }
  
  glDeleteProgram(shader);
  
  glfwTerminate();
  return 0;
  }
  </code></pre>
  
  <p>Shaders:</p>
  
  <pre><code>#shader vertex
  #version 330 core
  
  layout(location = 0) in vec3 position;
  
  
  
  void main()
  {
  gl_Position = vec4(position.x, position.y, position.z, 1.0);
  };
  
  #shader fragment
  #version 330 core
  
  layout(location = 0) out vec4 color;
  
  uniform vec4 Color_u;
  
  void main()
  {
  color = Color_u;
  };
  </code></pre>