Sign in to follow this  
at0m

Model Matrix Management with GL3 ?

Recommended Posts

at0m    122
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 ?

Share this post


Link to post
Share on other sites
V-man    813
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.

Share this post


Link to post
Share on other sites
at0m    122
Ok, well since I didn't get much replies I'll try both ways and give some feedback if some of you are interested.. Thanks for your reply by the way ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this