I’m currently programming a phong spot-light shader that uses the new ogl3 feature, ubos. My buffer object in the shader is :
`
Uniform Light {
vec3 origin;
vec3 color;
vec3 direction;
float intensity;
float linear_dissipation;
float illu_angle;
float max_illu_angle;
} Light[8];
`
When I calculate the various offsets via the function
glGetActiveUniformsiv()
my program returns
origin : 0 color : 16 intensity : 48 direction : 32 illu_angle : 48 max_illu_angle : 48 linear_dissipation : 48
I can’t use my intensity, illu_angle, max_illu_angle and linear_dissipation variables (well, only one of them 😀 ).
Given that
origin,color, anddirectionare all aligned on 16 bytes, I assume that OpenGL is combining the last four floats into a singlevec4.Did you actually try using one of them to verify that they are or are not aliased?