问题
I can't seem to be able to have both texture2D()
and textureCube()
in one shader. When I do, nothing shows up and there is no error. I tried this both with my own shader loader and the Apple GLSL shader builder and the same thing happens. It happens even if I have textureCube()
in the vertex shader and texture2D()
in the fragment. They seem to work fine by themselves, but as soon as they're called together, no matter in which order, nothing shows up.
回答1:
You need to bind both textures as uniforms in both shaders and assign two different texture units, each with one of the textures to the sampler uniforms.
来源:https://stackoverflow.com/questions/6027086/glsl-texturecube-and-texture2d-in-same-shader