Multi-colored Triangles



Whereas I know how to draw a triangle in opengl, i want to stay consistent with the cocos2d-x frame work.

I want to pass in a triangle list of mulitples of 3 vertices, with each vertex having a different color.

And I want to do this at “draw time”. So I ideally dont want to be creating nodes and adding them to the tree, etc.

Is there a built in shader type for this? All I can see are ones which take in a single color constant?

What class would be best to derive from?

OR if i go the whole hog, and just write my own function/shader to do this, what “gotchas” do i need to avoid in order to prevent me screwing up cocos (for example setting opengl states without resetting them, etc).

Anyone got any examples of this? Surely this is a “often requested” thing to do?

If i have an example of extending cocos to do something simple like this, then I can hit the ground running with more complex stuff.