c# - the offsets in one UBO used in multiple shaders -


i use 1 uniform block this:

uniform matrices {     mat4 pv_matrix;     mat4 screen_matrix; }; 

in different shaders same binding point defined explicitly uniformblockbinding.

to work uniform buffer object need query offsets way:

int offsets = new int[length]; gl.getactiveuniforms(id_program, length, indices, activeuniformparameter.uniformoffset, offsets); 

and call code every shader program same result.

if understood correct, offsets representing structure of uniform buffer object 1 called programs.

does make sense call many times or should enough call ones?

by default, uniform blocks laid out in shared ordering. such, need query layout in 1 program; block declaration shared , matches 1 have same layout.

or use std140 layout , not query anything.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -