So I have 10,000 lines and I’m trying to reduce the amount of color data I have on my card.
So right now I have 20,000 vertexs for the 10,000 lines, * 4, so 80,000 color floats. Is this really necessary? I use the same colors on all 10,000 lines. If it was a single color, I would just use a glColor4f(), but it’s two colors - one for each vertex. Can I do this with 8 floats? I have this all in a VBO. Is there any way I can tell the color pointer to use the same two vertex colors on all 10,000 lines? Or can I put this in my shader and have it toggle a bool or something between the two colors? Seems like a big waste of video card memory.
10k could be much higher… depends on the data. Could be 1,000,000. Wasn’t aware of a way with the color pointer, but thought perhaps there was some trick or that a varying could be toggled by the vertex shader, so each vertex would flip between 1 & 0. In doing so, I could use a simple if statement to assign the color in the shader. But I’m not that familiar on what is writable in the shader that could be passed to the next vertex. I know a varying can pass to the fragment shader, but wasn’t sure about it being passed to the next vertex.
You could also use unsigned bytes for the colours instead of floats; that would reduce the overhead to one quarter of what it was. An equal saving to V-man’s proposal.