arrays - 无法在 GLSL 中创建简单的结构数组
问题描述
我正在尝试uniform
在 GLSL 的计算着色器中创建一个结构数组(不是)(在 C++ 中使用 GLFW)。但是我在着色器编译时遇到了几个错误:
error C7546: OpenGL does not allow abstract declarations in structs
error C0000: syntax error, unexpected reserved word, expecting ';' at token "active"
以下是有问题的行:
struct ControlNode
{
vec3 pos;
float value;
bool active;
};
ControlNode controlNodes[8];
所以显然问题与bool active;
结构中的定义有关,但我不知道为什么。在代码中我得到这个错误:error C0000: syntax error, unexpected reserved word, expecting identifier or template identifier or type identifier at token "active"
当我在这里使用数组时:
for(int i = 0; i < 8; ++i){
if(controlNodes[i].active){
// some stuff here...
}
}
我想这是由前两个错误引起的,所以摆脱这些错误也会删除这个错误。
解决方案
推荐阅读
- java - 从目录选择器获取列表时,如何使用按钮更新列表视图?
- android - React Native on Android:无法确定当前字符,它不是字符串、数字、数组或对象
- c# - 如何使用类似的旧连接字符串信息连接到新服务器
- java - Java - 使用 ObjectMapper 反序列化为动态嵌套泛型类型
- python - 没有名为 unidecode 的模块
- autohotkey - 如何在非常简单的 AHK (AutoHotKey) 宏之后抑制不需要的“返回”字符?
- c++ - 如何在进入循环之前选择嵌套循环内调用的函数?
- mongodb - 如何通过 ssh 隧道将数据保存到远程 mongoDB?(拒绝连接)
- laravel - 如何在 Eloquent 中编写这个原始查询
- javascript - getPastEvents 未定义(重新)