for the reason i don’t understand sampling a cube map does not work inside a function (when the texture is not set)
here it works:
uniform samplerCube skybox;
void main() {
color = texture(skybox, vec3(1));
}
result is black as expected
here it does not work:
uniform samplerCube skybox;
vec4 get_skybox_color() {
return texture(skybox, vec3(1));
}
void main() {
color = get_skybox_color();
}
in that case it just does not render anything at all and there are no errors produced
it does not work even if i do it like that:
uniform samplerCube skybox;
vec4 get_skybox_color() {
return vec4(1);
return texture(skybox, vec3(1)); // this line is never executed obviously
}
void main() {
color = get_skybox_color();
}
opengl 4.1
could you please help me to understand what’s happening here
thx