iphone - 将纹理与适用于 iOS 的 GLSL 着色器和 OpenGL ES 2 一起使用

标签 iphone objective-c ios glsl opengl-es-2.0

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/

相关文章:

iPhone SDK :Saving a streamed audio file to Documents folder

ios - 使用Cordova在iTunes中打开应用

iphone - 我们可以使用 SLComposeViewController 在 FB 上共享视频吗?

ios - 在 NSMutableArray 中存储相同类的实例

ios - 为什么在设备旋转的纵向模式下不专门调用 UICollectionViewDelegateFlowLayout 方法?

iphone - UITableView : Adaptive cell height

iphone - 如何修复 iOS 中的视频方向问题

iphone - 手势问题

ios - Swift URL.path 更改 utf-8 字符的编码

ios - iOS服务器返回前如何响应