   Does anyone know which OpenGL state did I screw up?
Hello,Here comes a picture of the rendered output  
Fill mode. Second argument in glPolygonMode, should be GL_FILL instead of GL_LINE.;As a rule of thumb: IMO a rendering sub-system should not (with one exception, see below) rely on a state. Each rendering job should send a full set-up description, including any related parameters that can be changed by it at all. (I.e. in the case of models: VB/IB set-up, material belonging things, blending, primitive mode, shading, and so on.) Then the lowest layer just above OpenGL can be used to compare the requested set-up against an internal image of OpenGL's set-up, and differences then yield in OpenGL calls and, of course, changes to the internal image. This method is cheap enough and avoids confusion just like those in the OP, and it is useful for decoupling purposes.