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

发布于 2024-12-27 03:57:57 字数 120 浏览 3 评论 0原文

尽管进行了数小时的谷歌搜索,我似乎无法找到明确的答案。有人可以告诉我发生了什么事吗?我收到诸如“不支持版本 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

北方的巷 2025-01-03 03:57:57

OpenGL ES 2.0 规范指< a href="https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf" rel="nofollow noreferrer">GLSL ES,与 GLSL 不同。

GLSL ES 规范说:

该语言版本基于桌面 GLSL 1.10 版。不过,它包含 1.20 版中的许多功能,但 1.10 版中没有。

查看规范以了解支持的内容。

The OpenGL ES 2.0 spec refers to GLSL ES, which is not the same as GLSL.

The spec GLSL ES spec says:

This version of the language is based on version 1.10 of the desktop GLSL. However it includes a number of features that are in version 1.20 but not 1.10.

Check out the spec to see what's supported.

一花一树开 2025-01-03 03:57:57

OpenGL ES 不是 OpenGL,因此同样 OpenGL ES 的着色器语言也不是 OpenGL 的着色器语言。它们相似,但并不相同。因此没有与 GLSL ES 版本匹配的桌面 GLSL 版本。

OpenGL ES is not OpenGL, so similarly OpenGL ES's shader language is not OpenGL's shader language. They are similar, but they are not the same. So there is no desktop GLSL version that matches with GLSL ES's version.

余生一个溪 2025-01-03 03:57:57

实际上,您不必添加任何库,140 对于 Kindle Fire 来说太新了。删除版本规范或递减它直到着色器编译。您可能需要修复着色器中的一些其他错误,因为语言的各个版本确实存在一些差异。

您还可以使用 glGetString() 查询 GL_SHADING_LANGUAGE_VERSION 以获取您的设备支持的 GLSL 版本(保证至少 100 - ES 2.0 是第一个具有着色语言)。

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

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.

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).

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.

愛放△進行李 2025-01-03 03:57:57

首先你需要明确:

  • OpenGL和GLSL是针对桌面的
  • OpenGL ES和GLSL ES是针对嵌入式系统

如果你的系统使用OpenGL ES 2.0,那么你必须使用GLSL ES 1.0(着色器预处理器:#version 100)

这里很棘手,如果你使用#version 110或#version 120,那么机器会理解你想使用GLSL,而不是GLSL ES。下表来自维基百科将帮助您清楚

OpenGL ES 和 WebGL 使用OpenGL ES 着色语言

在此处输入图像描述

在 OpenGL 3.3 之前,两者的版本命名都很混乱,但是从 OpenGL 3.3 开始,命名开始变得干净

First of all you need to be clear:

  • OpenGL and GLSL are for desktop
  • OpenGL ES and GLSL ES are for Embedded System

If your system is using OpenGL ES 2.0, then you have to use GLSL ES 1.0 (Shader Preprocessor: #version 100)

It's tricky here that if you use #version 110 or #version 120, then the machine will understand that you want to use GLSL, not GLSL ES. Following table from Wikipedia will help you to be clear

OpenGL ES and WebGL use OpenGL ES Shading Language

enter image description here

Before OpenGL 3.3, the version naming was messy for both of them, but from OpenGL 3.3, the naming started to be clean

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文