The fix is in:
I had called glShadeModel(GL_FLAT) at some point in my code, because I was trying to derp while herping whilst writing it.
The fix was to change GL_FLAT with GL_SMOOTH. Thanks to Sponji for pointing that out.
I've been struggling to draw primitives correctly in my engine for quite a few hours, and I've managed to narrow it down to the fact that each vertex I'm passing along isn't colored individually.
The following snippet and screenshot demonstrates my issue.
glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); glColor3f(0.f,1.f,0.f); // Green glVertex2f(-50.f, -50.f); glVertex2f(50.f, -50.f); glVertex2f(50.f, 50.f); glColor3f(1.f, 0.f, 0.f); // Red glVertex2f(-50.f, 50.f); glEnd(); glEnable(GL_TEXTURE_2D);
This snippet should render a square where the top left vertex is red and the other three are green. However, as can be seen in this screenshot, this is not the case.
Disregard the purple sprites. Whenever I try to draw a primitive of any kind, all vertices get the last color called.
Apart from disabling/enabling GL_TEXTURE_2D, I'm not doing anything unusual.
This issue occurs both when rendering to a texture, and when I'm not.
Hope someone has experienced this issue before and can give me an aiding hand.
Best regards, Pimms.
Edited by Admiral Pimms, 09 September 2012 - 01:19 PM.