GLSL textureCube and texture2D in same shader

让人想犯罪 __ 提交于 2019-12-11 01:12:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!