GLSL: “Invalid call of undeclared identifier 'texture2D'”

蓝咒 提交于 2019-12-05 19:44:32

问题


I'm on a Mac, using Swift, and using OpenGL 3.2. I'm also using XCode 6.1 Beta so I suppose that's the most likely explanation, because it doesn't seem to me like this makes sense.

I can't find any evidence that this shouldn't be supported, but this fragment shader is resulting in the error Invalid call of undeclared identifier 'texture2D' during compilation:

#version 150

uniform sampler2D usTexture;

in vec2 vTextureCoord;

out vec4 FragColor;

void main() {
  vec4 color = texture2D(usTexture, vTextureCoord);
  FragColor = color;
}

回答1:


Cripes. Finally found the answer right after I posted the question. texture2D has been replaced by texture.



来源:https://stackoverflow.com/questions/26266198/glsl-invalid-call-of-undeclared-identifier-texture2d

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