Jeffg
12-22-2011, 05:58 PM
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.
gl.glLineWidth(thinline);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, highlines_vbo[0]);
gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0);
gl.glEnableClientState(GL.GL_COLOR_ARRAY);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, highlines_vbo[1]);
gl.glColorPointer(4, GL.GL_FLOAT, 0, 0);
gl.glDrawArrays(GL.GL_LINES, 0, highlines);
gl.glDisableClientState(GL.GL_COLOR_ARRAY);
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.
gl.glLineWidth(thinline);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, highlines_vbo[0]);
gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0);
gl.glEnableClientState(GL.GL_COLOR_ARRAY);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, highlines_vbo[1]);
gl.glColorPointer(4, GL.GL_FLOAT, 0, 0);
gl.glDrawArrays(GL.GL_LINES, 0, highlines);
gl.glDisableClientState(GL.GL_COLOR_ARRAY);