1

我的片段着色器包含以下结构变量。

struct Material
{
    vec3 ambient;
    vec3 diffuse;
    vec3 specular;
    float shininess;
};

uniform Material material;
// another uniform
uniform float tmp;

在 vispy 上使用

self.program['material.ambient'] = [1,1,1]
self.program['material.diffuse'] = [1,0.7,1]
self.program['material.specular'] = [0.5,1,1]
self.program['material.shininess'] = 32
self.program['tmp'] = 10

我收到以下错误

WARNING: Value provided for 'material.diffuse', but this variable was not found in the shader program.
WARNING: Value provided for 'material.ambient', but this variable was not found in the shader program.
WARNING: Value provided for 'material.specular', but this variable was not found in the shader program.
WARNING: Value provided for 'material.shininess', but this variable was not found in the shader program.
INFO: Program has unset variables: { 'material.specular', 'material.shininess', 'material.diffuse', 'material.ambient'}

我正在使用正确的着色器程序并链接了正确的片段着色器。我认为 vispy 还不支持结构类型,是否有任何解决方法可以传递这些值?

4

0 回答 0