I am trying to make my very own 2D engine. I have finished with all of the window programming and it works so far, but now I'm up to the tough part, the graphics. I know HOW to draw the graphics but I don't know which way I should do them.
I am using vertex buffers and I know that I can change the coordinates of each point. My questions: Should I just create 1 VBO, and just keep changing the values and texture for each object? How many VBOs do I need? If I want to have a view that follows the player, will I need to change the points to make it relative to the player, or is there a function that can do this for me?
The vertexes should be more or less unchanging, and you should use the model view matrix to place things where you want them on the screen
For things like scrolling / zooming, you would just apply those changes to the model view first, then for each individual object that is drawn you'd basically do this:
- push matrix
- translate to object's position
- do any rotation or other stuff you want
- draw the object
- pop matrix