Wasabi
05-18-2011, 12:24 PM
In programing my vertex shader, I've come to a question:
GPU's are far faster than CPU's, so they'll be able to do matrix multiplications faster than my own program will. However, the more matrixes I send into the GPU, the more calls I'll have to make to glUniformMatrix*().
So, in wanting to do 3D rotations, is it better to:
- send four uniforms to the shader (rotation in X, rotation in Y, rotation in Z, translation) and multiply them in there, having to possibly make four calls to glUniformMatrix*()
OR
- do the multiplications in the CPU and then only send a single glUniformMatrix*() with the resulting matrix?
GPU's are far faster than CPU's, so they'll be able to do matrix multiplications faster than my own program will. However, the more matrixes I send into the GPU, the more calls I'll have to make to glUniformMatrix*().
So, in wanting to do 3D rotations, is it better to:
- send four uniforms to the shader (rotation in X, rotation in Y, rotation in Z, translation) and multiply them in there, having to possibly make four calls to glUniformMatrix*()
OR
- do the multiplications in the CPU and then only send a single glUniformMatrix*() with the resulting matrix?