0

I'm working on 2D quad batching. The vertex array is very structured: 4 vertices per quad with position and texture vectors, but I only need one color per quad.

Putting duplicate color information in every vertex seems like a waste.

Is there a way I can optimize this?

Sam Washburn
  • 1,817
  • 3
  • 25
  • 43

1 Answers1

0

Color is attribute of vertex and not of primitive. While using vertex attribute arrays openg mandates to have number of vertices should be equal to no tex coords, no of normals, no of colors and so on.

Some references:

How can I specify per-face colors when using indexed vertex arrays in OpenGL 3.x?

How to specify color per primitive for glDrawElements()

Community
  • 1
  • 1
Abhishek Bansal
  • 5,197
  • 4
  • 40
  • 69