简体   繁体   English

我可以在OpenGL ES 2.0中使用哪些版本的GLSL?

[英]What versions of GLSL can I use in OpenGL 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." 我收到的错误是“不支持版本140”。 Is this my device (Kindle Fire) or GL ES 2.0? 这是我的设备(Kindle Fire)还是GL ES 2.0? Do I need to add libraries or anything? 我需要添加库还是其他什么?

The OpenGL ES 2.0 spec refers to GLSL ES , which is not the same as GLSL. OpenGL ES 2.0规范指的是GLSL ES ,它与GLSL不同。

The spec GLSL ES spec says: 规范GLSL ES规范说:

This version of the language is based on version 1.10 of the desktop GLSL. 此版本的语言基于桌面GLSL的1.10版。 However it includes a number of features that are in version 1.20 but not 1.10. 但是,它包含许多版本1.20但不是1.10的功能。

Check out the spec to see what's supported. 查看规范以查看支持的内容。

OpenGL ES is not OpenGL, so similarly OpenGL ES's shader language is not OpenGL's shader language. OpenGL ES不是OpenGL,因此类似OpenGL ES的着色器语言不是OpenGL的着色器语言。 They are similar , but they are not the same. 它们很相似 ,但它们不一样。 So there is no desktop GLSL version that matches with GLSL ES's version. 因此,没有与GLSL ES版本匹配的桌面GLSL版本。

you actually don't have to add any libraries, 140 is far too new for Kindle Fire. 你实际上不需要添加任何库,140对于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. 您可能需要修复着色器中的其他一些错误,因为该语言的各个版本确实存在一些差异。

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). 您还可以使用glGetString()查询GL_SHADING_LANGUAGE_VERSION以获取设备支持的GLSL版本(保证至少为100 - ES 2.0是第一个使用着色语言的版本)。

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. 另外,正如其他人所提到的,OpenGL ES GLSL与OpenGL ES的语言不同(我认为这很明显,OpenGL ES不是OpenGL),因此版本号不匹配。 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. 然而,有GL_ARB_ES2_compatibility及其对ES3,ES3.1和ES3.2的扩展,其中描述了ES /非ES GLSL语言的映射,并且使用它们可以在非ES上获得类似ES的功能。上下文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM