I’m currently using a call to glUniformMatrix4fv every call I have to render something I have on the screen to update the modelview/projection view in the vertex shaders of my shader programs. While working on a GUI application that renders a bunch of buttons, a panel and a bunch of labels, I noticed a huge performance hit from my code using std::map calls. I removed those, but didn’t get the performance gains I was expecting. The application will run at around 40 fps. This doesn’t sound so bad, but considering all I’m doing is rendering ~400 textured triangles with very simple shaders, I’m disappointed. My terrain-mesh application that renders a terrain made up of close 9000 multi-textured tris runs faster. I’m assuming it’s because to render the terrain mesh, I make about 2 calls to glUniform. To render a line of text, I make (3+n) calls to glUniform where n is the number of characters. The data that is sent each character is a 4x4 matrix for the modelview, to describe the characters position. The other three are color(4f), projection(4x4f), and texture unit (1i).
Does anyone have any thoughts on this, or can offer an alternative that is easier than generating & storing the vertices & texture coordinates and colors for each line of text I have at runtime?
I’m quite worried because eventually I want to have many models, about 50-100, running around on screen. And buffering & updating individual vertex data for each of them just doesn’t seem practical, or video memory efficient.