To start, this is my VBO Data Struct:
//-----------------------------------------------------------------
struct Vertex
//-----------------------------------------------------------------
{
//-----------------------------------------------------------------
Vertex()
: x(0), y(0), z(0),
s(0), t(0)
//-----------------------------------------------------------------
{}
//-----------------------------------------------------------------
Vertex(Vertex& rhs)
: x(rhs.x), y(rhs.y), z(rhs.z),
s(rhs.s), t(rhs.t)
//-----------------------------------------------------------------
{}
// Position
float x;
float y;
float z;
// Texture Coords
float s;
float t;
};
I am reading a lot of tutorials and all seem to submit the color of their polygons with the VBO to the GPU. However, if you ever change the color, you need resubmit the data to the GPU. Why is that so common, when you can bind the color via an uniform? Isn't that heaps and bounds faster? One could argue that you need to bind the color then for each Polygon or at least Sprite or Model, depending on what you are doing, if you use the same shader for each of them, which is common practice.
So I am confused how to design my (learning) 2D Game from the ground up. Should I put the 4 floats (r,g,b,a) into the VBO and add it to the layout or simply keep changing it via glUniform4fv? Is there a best practice for this?