Model Matrix Management with GL3 ?
Hi,
I'm thinking about the best way to manage the instance matrices with shaders.
These matrices hold the translation and rotation of each entity in the scene, but only at the scene graph hierarchy level : if I want to draw say a tree which is part of a forest which is located on a terrain, the instance matrix M(final) would be computed like such :
M(final) = M(camera)*M(terrain)*M(forest)*M(instance);
I'm thinking about computing this on the cpu, (while exploring the scene graph). Then I'm hesitating about how to provide these matrices to the shaders : put the final matrix in a UBO (with the rest of the scene parameters eg projection, fog, lights), or use a call to glUniform ? Which one is better in terms of performance ? Or are they better solutions ?
I'm not using GL3 but I did try UBO with GL 2.1. The driver was a little weird so I didn't use it but the concept I guess is to make 1 UBO for your {vs, gs, fs) pair and put all the uniforms in it with one call to glBufferSubData. It is suppose to be better than calling a lot of glUniform.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement