issues about shaders and transformations
- If I'm not wrong, shaders are programs that run in GPU, right?
- Do we send data to this programs using glUniformMatrix*?
- I don't know if it's right but if I send a MVP matrix to the shader, the object's vertices that I want to render will use the position calculated by the shader right before calling the render function.
- If I want to render a lot of objects and I must send the MVP matrix then render the object right after, so I will have a code that send to GPU -> render a lot of times. However if I'm not wrong again this is not a good practice because I'm losing performance because the cost of send information to GPU is very expensive. So a way to get a better performance is send all the informations to GPU then render all the objects.
- And the questions of 1 million dollars is, How can the shader program identify that the MVP matrix is used by a single object and not another one?