GLSL: Built-in attributes not accessible for iPhone Apps?

天大地大妈咪最大 提交于 2019-12-01 13:04:18

Those attributes aren't available in GL ES, whether on the iPhone or elsewhere. And the same goes for WebGL. You need to write your own matrix code, or use GLKit if you're supporting only iOS 5+, and supply attributes for yourself. See Kronos' reference card for an incredibly concise summary of what made it into ES 2.0 — amongst other things it lists all the available built-in special variables as:

  • gl_Position
  • gl_PointSize
  • gl_FragCoord
  • gl_FrontFacing
  • gl_PointCoord
  • gl_FragColor
  • gl_FragData[n]

GLKit's maths stuff is really good because it inlines and uses the ARM's NEON SIMD unit. I consider it a sufficient reason to specify iOS 5 as a minimum in all new GL projects.

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