Is there a compact way to specify solid per-triangle colors when using Vertex Buffer Objects?
I'm drawing a VBO in GL_TRIANGLES mode, and I just draw solid triangles.
Right now I have to create a 4-component color for every single vertex. For each triangle that means 3 colors, which results in a massive amount of 12 values. But all I need is a solid color for the triangle.
Is there a way of "compressing" this amount of data so that -at least in memory- there are just 4 values stored to define the color of a triangle?
You can call glColor* before you render your triangle. It sets the "current" vertex color, and then you don't need to bother with colors per-vertex.
If its an rgb color you should be able to store it as a single int
Each byte in the int represents a color argb.
You could choose to use the alpha channel or ignore it