v3c70r / GL4Framework

An OpenGL 4 Framework
5 stars 2 forks source link

Move matrices to uniformblocks #1

Closed v3c70r closed 9 years ago

v3c70r commented 9 years ago

Right now, matrices are simply uniforms in shaders, which means that when updating those matrices, values must be passed for every shaders. A way to improve the performance is to set uniformblocks and bind them when necessary.

However, since the frequency of updating those matrices are different, it's better to put them in different uniformblocks. To be more specific, matrices can be separated into three types:

Thus, we can simply put Project Matrix and Camera Matrix in a uniformblock and update them in every frame. Model Matrix put in another frame and update it for every object.

v3c70r commented 9 years ago

Enhancement finished