• Advertisement
Sign in to follow this  

Individual vertex coloring is somehow disabled.

This topic is 1957 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Edit:

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.

---

Good day!

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.

[CODE]
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);
[/CODE]

This snippet [i]should[/i] 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.

[img]http://i.imgur.com/7iB7p.png[/img]

Disregard the purple sprites. Whenever I try to draw a primitive of any kind, [b]all[/b] 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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement