Google 不知何故不存在此信息。
我需要将纹理坐标传输到我的着色器程序,但 ATTRIB_TEXCOORD 不存在。我用 glVertexAttribPointer 做什么?
谢谢。
最佳答案
给定着色器程序和纹理属性的名称(在此示例中,属性名为“textureCoords”),您将获得如下索引:
int a_texture = glGetAttribLocation(program, "textureCoords");
然后像这样在 glVertexAttribPointer 中使用 a_texture:
glVertexAttribPointer(a_texture, 2, GL_FLOAT, 0, 0, textureVertices);
关于iphone - 将纹理与适用于 iOS 的 GLSL 着色器和 OpenGL ES 2 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4788453/