I'm using OpenGL 3.3+, and I'm trying to create an orthographic projection to draw on screen. I have the model data in a buffer:

X    Y
0,   0
50,  100
100, 0

And I create my Model-View-Projection matrix as follows:

glm::mat4 projection = glm::ortho(0.f, 100.f, 0.f, 100.f);
    glm::mat4 view = glm::lookAt(
        glm::vec3(0, 0, 5),
        glm::vec3(0, 0, 0),
        glm::vec3(0, 1, 0)
    glm::mat4 model = glm::mat4(1);

    glm::mat4 mvp = projection * view * model;

In my debugging efforts, I used the values from the model buffer and did the same operations the shader was doing, but on the CPU using GLM:

glm::vec4 pos(x, y, 1.0, 1.0);
posicao = mvp * posicao;

And got these results:

X    Y
-1, -1
0,   1
1,  -1

Which were as expected, as the Vertex Shader's code is plain simply multiplying the matrix by the incoming vec4(vec2(x, y), 1, 1). In my understanding, this should've outputted a triangle on my screen, but it's blank. What are some ways I can debug this?

  • \$\begingroup\$ Have you tried an OpenGL debugger like gdebugger? They'll let you know what's actually getting stored in the VBOs and the contents of various buffers. \$\endgroup\$
    – House
    May 2, 2014 at 14:50
  • \$\begingroup\$ Yes, using GDebugger, I can see the buffers and they're all correct, the shaders, the matrix being sent to the shader, it's all correct, that's why I don't understand why it won't appear. \$\endgroup\$ May 2, 2014 at 15:27
  • 2
    \$\begingroup\$ Have you tried disabling backface culling or inverting your winding order? I find it's much easier to start with a working example, then move on from there. \$\endgroup\$
    – House
    May 2, 2014 at 15:57

1 Answer 1


Some of the things I typically try when nothing appears to be drawing on the screen:

  • Disable backface culling (in case your geometry winding is wrong)
  • Change the glClearColor() to something other than black (texturing problems can cause your geometry to be drawn solid black, in which case you won't see it)
  • Change your fragment shader to output a specific solid color
  • If you use framebuffers anywhere, try explicitly calling glBindFramebuffer(GL_FRAMEBUFFER, 0) before drawing your triangle, to rule out binding leaks
  • Continuously rotate your camera angle in a loop (in case the geometry is accidentally behind you)
  • Make sure your geometry is not within your near clip distance (try setting the near clip distance as small as possible, and moving the geometry further away)
  • \$\begingroup\$ Another way you could end up with a blank screen is if your glClearColor call is not where you think it is, or there is an additional one. \$\endgroup\$
    – Ryan1729
    Aug 10, 2017 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .