我可以在 OpenGL ES 2.0 中使用哪些版本的 GLSL?
尽管搜索了数小时,但我似乎无法找到明确的答案.有人可以告诉我发生了什么吗?我收到诸如不支持版本 140"之类的错误消息.这是我的设备(Kindle Fire)还是 GL ES 2.0?我需要添加库吗?
I can't seem to find a clear answer on this, despite hours of googling. Can someone just tell me what's going on? I get errors saying things like, "version 140 is not supported." Is this my device (Kindle Fire) or GL ES 2.0? Do I need to add libraries or anything?
推荐答案
其实你不需要添加任何库,140 对 Kindle Fire 来说太新了.删除版本规范或递减它,直到着色器编译.您可能需要修复着色器中的一些其他错误,因为语言的各个版本确实存在一些差异.
you actually don't have to add any libraries, 140 is far too new for Kindle Fire. Either remove the version specification or decrement it until the shader compiles. You may need to fix some other errors in the shader as the individual versions of the language do have some differences.
您还可以使用 glGetString()
查询 GL_SHADING_LANGUAGE_VERSION
以获取您的设备支持的 GLSL 版本(保证至少为 100 - ES 2.0 是第一个一个带有阴影语言的).
You can also query GL_SHADING_LANGUAGE_VERSION
using glGetString()
to get version of GLSL that is supported on your device (guaranteed to be 100 at least - ES 2.0 is the first one with a shading language).
另外,正如其他人所提到的,OpenGL ES GLSL 与 OpenGL ES 不是同一种语言(我认为这很明显,OpenGL ES 不是 OpenGL),因此版本号将不匹配.但是有 GL_ARB_ES2_compatibility 及其对 ES3、ES3.1 和 ES3 的扩展.2,其中描述了 ES/非 ES GLSL 语言的映射,并且使用这些语言可以在非 ES 上下文中获得类似 ES 的功能.
Also, as mentioned by the others, OpenGL ES GLSL is not the same language as OpenGL ES (I thought that was rather obvious, OpenGL ES is not OpenGL) so the version numbers will not match. There is however GL_ARB_ES2_compatibility and its extensions to ES3, ES3.1 and ES3.2, where the mapping of the ES / non-ES GLSL languages is described, and using those it is possible to get ES-like functionality on an non-ES context.
相关文章