Hello,
I am working on my own game engine using OpenGL. I am using unfiorm block to define Light structure arrays, as uniform in my fragment shader. The program works fine on Intel HD Graphics but the struct uniforms are not working on Nvidia Driver.
Here is a little piece of my code:
struct Light {
int lightType;
int castsShadow;
float lightCutOffAngle;
int shadowmapId;
vec4 lightRGBI;
vec4 lightSpecularRGBI;
vec3 lightPosition;
vec3 lightAttenuation;
vec3 lightSpotDirection;
mat4 lightMatrix;
};
layout (std140) uniform Lights {
Light u_lights[MAX_NUM_LIGHTS];
};
now, the size of Light struct with alignment is 160 (Thats what I calculated)
so when trying to update second light I am using (lightNumber * 160) as offset for glBufferSubData()
this works fine on Intel HD Graphics but it is not working on Nvidia