我的顶点着色器中有三个glsl属性
attribute highp vec4 Position;
attribute mediump vec4 UV;
attribute mediump vec3 Normal;
Run Code Online (Sandbox Code Playgroud)
即时通讯绑定使用
glBindAttribLocation(program, 0, "Position");
glBindAttribLocation(program, 1, "Normal");
glBindAttribLocation(program, 2, "UV");
Run Code Online (Sandbox Code Playgroud)
但是,我收到了一个错误
无法找到顶点着色器属性"Normal"以匹配BindAttributeLocation请求.
为什么它可以找到Position和UV属性,但不能找到Normal属性.
任何帮助都会受到高度赞赏,因为我很困惑.
干杯
编辑:我在Android OpenGLES20上遇到了同样的问题.我将添加示例代码:该类的其余部分是官方的GLSurfaceView教程
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
String mVertexShader = "uniform mat4 uMVPMatrix;\n " +
"attribute vec4 aPosition;\n " +
"attribute vec4 aNormal; \n " + //this is the line I added
"attribute vec2 aTextureCoord;\n " +
"varying vec2 vTextureCoord;\n " +
"void main() {\n " +
"gl_Position = uMVPMatrix …Run Code Online (Sandbox Code Playgroud)