Jump to content

  • Log In with Google      Sign In   
  • Create Account


Individual vertex coloring is somehow disabled.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Admiral Pimms   Members   -  Reputation: 114

Like
0Likes
Like

Posted 09 September 2012 - 09:15 AM

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.

	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.

Posted Image

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.


Sponsor:

#2 Sponji   Members   -  Reputation: 1124

Like
1Likes
Like

Posted 09 September 2012 - 12:00 PM

Try calling glShadeModel(GL_SMOOTH) before glBegin.
Derp

#3 Admiral Pimms   Members   -  Reputation: 114

Like
0Likes
Like

Posted 09 September 2012 - 01:18 PM

That worked! Thank you so much!

I just hate it when I run into these speed bumps, which quite frankly is caused by my own lack of attention.

Best regards, Pimms.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS