OpenGL does not draw as expected <p>I am currently working my way through the current OpenGL Programming Guide, Version 4.3. I implemented the code of the first example, that should display two triangles. Basically pretty simple. </p> <p>But nothing is displayed when I run that code (just the black window).</p> <p>This is the init function where the triangles are created:</p> <pre><code>GLuint vertexArrayObjects[1]; GLuint buffers[1]; const GLuint vertexCount = 6; void init() { // glClearColor(0,0,0,0); glGenVertexArrays(1, vertexArrayObjects); glBindVertexArray(vertexArrayObjects[0]); GLfloat vertices[vertexCount][1] { {-90.0, -90.0}, { 85.0, -90.0}, {-90.0, 85.0}, { 90.0, -85.0}, { 90.0, 90.0}, {-85.0, 90.0} }; glGenBuffers(1, buffers); glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); ShaderInfo shaders[] { {GL_VERTEX_SHADER, "one.vsh"}, {GL_FRAGMENT_SHADER, "one.fsh"}, {GL_NONE, nullptr} }; GLuint program = LoadShaders(shaders); glUseProgram(program); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, ((char *)NULL + (0))); glEnableVertexAttribArray(0); } </code></pre> <p>And the very simple draw:</p> <pre><code>void display() { glClear(GL_COLOR_BUFFER_BIT); glBindVertexArray(vertexArrayObjects[0]); glDrawArrays(GL_TRIANGLES, 0, vertexCount); glFlush(); } </code></pre> <p>But as said, nothing is drawn. Is there an error in my implementation?</p> <p><em>The full code is <a href="http://pastebin.com/4XpC2xZQ" rel="nofollow">here</a> and LoadShaders (straight from the books website, so this should be out of interest) is <a href="http://pastebin.com/ZQHdRhG4" rel="nofollow">here</a>. The shaders are <a href="http://pastebin.com/Ydf4PMSA" rel="nofollow">here</a>.</em></p>