我尝试在GLSL中进行高斯滤波,如下所示:
int cnt = (blurLen - 1) / 2;
for (int i = 0; i <= blurLen; i++) {
float s1 = float(i - cnt);
vec3 off1 = vec3(v1[0]*s1, v1[1]*s1, v1[2]*s1);
vec3 base = T + off1;
for (int j = 0; j <= blurLen; j++) {
float s2 = float(j - cnt);
vec3 off2 = vec3(v1[0]*s2, v1[1]*s2, v1[2]*s2);
cubetex += kernel3[j] * textureCube(skybox, base + off2);
}
}
但收到错误:错误:0:49:&#39;我&#39; :循环索引不能与非常量表达式进行比较
我也尝试了While循环,但得到了:错误:0:51:&#39;而#39; :不允许这种类型的循环
那我该怎么做呢?