具有结构的glGetUniformLocation问题

问题描述

有。

我有一些可以在Java中运行的代码,但是在C ++中却出错了。

int globalAmbLoc = glGetUniformLocation(this->rendering_program_geometry,"globalAmbient");

if (globalAmbLoc == -1) throw exception("No globalAmbLoc in the vertex shader");

glProgramUniform4fv(this->rendering_program_geometry,globalAmbLoc,1,&GLOBAL_AMBIENT[0]);

int ambLoc = glGetUniformLocation(this->rendering_program_geometry,"light.ambient");

if (ambLoc == -1) throw exception("light.ambient");

光线在哪里

struct PositionalLight
{
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec3 position;
};

uniform PositionalLight light; 

当尝试从结构中获取任何字段时,为什么ambLoc会获得“ -1”?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)