I am new to OpenGL 3 and graphics programming, and want to create some basic 2d graphics. I have the following scenario of how I might go about drawing a basic (but general) 2d rectangle. I'm not sure if this is the correct way to think about it, or, if it is, how to implement it.
In my head, here's how I imagine doing it:
t = make_rectangle(width, height)
build general VBO, centered at 0, 0
optionally: t.set_scale(2)
optionally: t.set_angle(30)
t.draw_at(x, y)
calculates some sort of scale/rotate/translate matrix (or matrices), passes the VBO and the matrix to a shader program
Something happens to clip the world to the view visible on screen.
I'm really unclear on how 4 and 5 will work. The main problem is that all the tutorials I find either: use fixed function pipeline, are for 3d, or are unclear how to do something this "simple".
Can someone provide me with either a better way to think of / do this, or some concrete code detailing performing the transformations in a shader and constructing and passing the data required for this shader transformation?