Hello, I used uniform data struct in my c++ files as below
class UniformData
{
public:
glm::mat4 view;
glm::vec3 camerapos;
glm::vec3 lightpos;
int projmode;
int fitmode;
int width;
int height;
float zmin;
float zmax;
float eyewide;
};
and in my vert shader file, I defined
layout (set = 0, binding = 0) uniform UniformData
{
mat4 view;
vec3 camerapos;
vec3 lightpos;
int projmode;
int fitmode;
int width;
int height;
float zmin;
float zmax;
float eyewide;
} uniformData;
But on my window, nothing appear (only blank window)
So I changed the line
layout (set = 0, binding = 0) uniform UniformData
to either
layout (std430, set = 0, binding = 0) uniform UniformData
orlayout (std140, set = 0, binding = 0) uniform UniformData
Still nothing appear
so I changed
glm::vec3 camerapos;
glm::vec3 lightpos;
to
glm::vec4 camerapos;
glm::vec4 lightpos;
(Also changed vert file accordingly)
Then the window shows the objects all right
So why can’t I use vec3 camerapos, vec3 lightpos above?
Could you please explain to me why this happens?