views:

783

answers:

2
+1  A: 

You can do this by using OpenGL Color Index Mode. However, be aware that, in my experience, this actually is slower on most modern graphics card than just specifying each vertex color.

In color index mode, you send a separate color array, then each vertex specifies an index into the array, instead of a full rgb/rgba. It's more memory efficient, but not as optimized in most hardware drivers.

Reed Copsey
+3  A: 

You could use a vertex shader to do this by sending in a boolean flag for each vertex describing what color to be. Really the simplest/fastest thing is probably just to submit the color for each vertex.

If opengl had the ability to have multiple vertex streams and indices that might work (but also would probably not be worth it).

fuzzy-waffle