问题标签 [opengl-es-3.0]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
981 浏览

android - 使用 OpenGL 的 Unity 插件用于 Project Tango

我正在使用 Unity for Project Tango 开发 AR 应用程序。

我想要完成的一件事是在使用他们随 SDK 提供的 AR 示例时从设备获取帧图像 - https://github.com/googlesamples/tango-examples-unity

问题是他们正在使用不返回帧缓冲区的 IExperimentalTangoVideoOverlay(图像在着色器中从 YUV 转换为 RGB)。

我已经注册了 OnExperimentalTangoImageAvailable 事件并调用了一个 android 本机插件来使用 glReadPixles 来获取帧图像,但它也不起作用(可能是因为它是一个没有上下文的库?)

我对其他解决方案持开放态度......但这是从我正在使用的 android 插件读取图像帧的代码 -

公共无效解码(){

请大家感谢我能得到的所有帮助。谢谢!

编辑:

问题解决了!感谢杰森郭。

我应该使用 GLES20 而不是 GLES30。Android 也不支持 GL_LUMINANCE。

固定线是 - GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, bb);

0 投票
1 回答
2010 浏览

java - Android OpenGL Es 3.0 创建圆

我曾尝试实施其他帖子的建议,例如:

以及 Stack OverFlow 上的许多其他人,但都没有工作。

要么我打电话给

方法并且没有得到输出或代码已过时并且使用起来有点毫无意义。

我正在尝试创建一个基本的圆圈。我可以完美地创建三角形和正方形,但是我不知道如何正确实现创建圆。

根据我目前的知识,只需添加更多顶点即可创建一个圆,如下图所示。但是我不知道如何实现这一点。

在此处输入图像描述

这是我当前的 SurfaceView 渲染器:

我的 SurfaceView 如下:

我目前的 Circle 实现如下:

0 投票
1 回答
248 浏览

java - OpenGL ES 3.0 通过引用调用对象来添加重力和 OnCLick 事件

我是 OpenGL 的新手,我正在尝试找到一种方法来为绘制的对象(例如三角形)赋予某种 ID。通过这种方式,我可以调用 Id 并为其赋予动作以及广告触摸事件。

我不确定这是否是正确的方法,或者是否有更好的方法来做到这一点。我制作了对象,但不知道如何调用它们并赋予它们动作或 onClick 事件。我环顾四周,但是很多方法似乎已经过时并且不起作用,或者链接现在已经死了。

我有一个这样的渲染器:

表面视图如下:

还有一个三角形类:

我想做以下事情:

0 投票
1 回答
2922 浏览

opengl - Most Efficient Way to Retrieve Texture Pixel Data?

I know Directx for Dx9 at least, has a texture object where you are able to get only a small portion of the texture to CPU accessible memory. It was a function called "LockRect" I believe. OpenGL has glGetTexImage() but it grabs the entire image and if the format isn't the same as the texture's then it is going to have to convert the entire texture into the new pixel format on top of transferring the entire texture. This function is also not in OpenGL ES. Framebuffers is another option but where I could potentially bind a framebuffer where a color attachment in connected to a texture. Then there is glReadPixels which reads from the framebuffer, so it should be reading from the texture. glReadPixels has limited pixel format options so a conversion is going to have to happen, but I can read the pixels I need (which is only 1 pixel). I haven't used this method but it seems like it is possible. If anyone can confirm the framebuffer method, that it is a working alternative. Then this method would also work for OpenGL ES 2+.

Are there any other methods? How efficient is the framebuffer method (if it works), does it end up having to convert the entire texture to the desired format before it reads the pixels or is it entirely implementation defined?

Edit: @Nicol_Bolas Please stop removing OpenGL from tags and adding OpenGL-ES, OpenGL-ES isn't applicable, OpenGL is. This is for OpenGL specifically but I would like it to be Open ES 2+ compatible if possible, though it doesn't have to be. If a OpenGL only solution is available then it is a consideration I will make if it is worth the trade off. Thank you.

0 投票
0 回答
116 浏览

opengl-es-3.0 - GLES 3.0 模拟器实例化渲染

我想获得实例渲染的好处。但是当我使用 PowerVR SDK v. 4.0 中的 GLES 3.x PowerVR 模拟器时,我没有成功。我需要在随机位置绘制单位四边形。位置作为属性传递给着色器——每个实例使用 glVertexAttribDivisor 1 个位置。结果,我只看到了 5 个 100 的矩形。我用桌面 OpenGL 测试了实例,我看到了所有 100 个四边形实例。

我已经在 PowerVR 论坛上发布过,但也许这里有人有解决方案。这是我用于解决方法的测试应用程序的链接。

0 投票
1 回答
1199 浏览

android - getGlEsVersion() 在我的 android 版本 6.0.1 的 nexus 5 上返回 3.0

我正在使用此代码在手机上获取 OpenGL ES 版本。

我从这个链接中找到了这段代码:Is there a way to check if Android device support openGL ES 2.0?

在我的 Nexus 5 上,我将 GLES 版本设为 3.0。但是根据这个文档http://developer.android.com/guide/topics/graphics/opengl.html,我应该得到 3.1 因为“OpenGL ES 3.1 - Android 5.0 (API level 21) 支持这个 API 规范和更高。”

我想我应该得到 3.1 作为 OpenGL ES 版本。谁能告诉我为什么我得到 3.0 作为 OpenGL ES 版本?

0 投票
0 回答
244 浏览

android - OpenGL ES 3.0 遮挡查询:glGenQueries 总是以 INVALID_OPERATION 失败

我正在尝试对在三星 Galaxy S6 Edge+ 上绘制为纹理四边形的 2D 精灵进行每像素碰撞检测。使用 C# 和 OpenTK。

glGenQueries 始终不返回任何查询名称(数组“查询”未更改),并且查看是否进行查询的测试总是失败并且我的异常命中。

返回的 OpenGL 错误为 1282 (INVALID_OPERATION)。规范说这发生在我什至没有使用的 glBegin 和 glEnd 之间(ES 不支持它们)。

我不认为我在这段代码中做错了什么,但问题在于设备功能或帧缓冲区/图形模式的设置。

我的帧缓冲区是这样设置的(8 个模板位,我试过 1. 没有深度(2d 游戏))

任何帮助表示赞赏,我已经在谷歌中使用了很多年。

问候

马特

0 投票
1 回答
1161 浏览

opengl-es - 在 openGL ES 3.0 中“按原样”获取整数/字节纹理数据

我在 IOS 上玩一些技巧来尝试构建一个 CPU-GPU-hybrid JPEG 编码器。从我对 CPU 的测试来看,我相信使用 GPU 来执行 DCT 和量化步骤很有意义,并且应该会显着提高性能(压缩大量 JPEG 是我应用程序的瓶颈)。有了变换反馈,这应该是可行的,因为我已经用它在 GPGPU 计算中获得了很好的结果。棘手的部分是如何有效地获取数据(RGBA 的无符号整数)。

如前所述,我曾经使用 openGL ES 3.0 进行 GPGPU 计算,所以我只有浮点纹理的经验,这是由

并通过

但是现在我的输入数据存储为一个无符号字节数组(或 uint8),我每次都需要依次获取其中的 64 个。我想我可以将它们作为无符号字节的纹理获取,或者更有效地作为无符号整数的纹理获取,然后通过位移将它们分开。

我的问题是,我该怎么做呢?更具体地说,我应该如何设置glTexImage2D()的internalFormat格式类型?我尝试了很多组合,但所有组合在着色器中都只提供 0(我仔细检查了数据源,它们不是零)。

0 投票
1 回答
972 浏览

android - Android Opengl ES 3.0 像素缓冲区对象和 glReadPixel

我想使用 PBO(适用于 Android 4.3+)来提高 glReadPixels() 性能,因为我的测试设备中的每一帧 glReadPixels 大约需要 30~50ms(1280*960)。但我不能直接在 Java 中使用 glReadPixels,因为最后一个参数不能为零或“null”。我也尝试使用这里提到的 ndk 。但是最后一个参数必须是 (void*) 在我的 ndk 的 GLES3/gl3.h 中。所以问题是如何使用 glReadPixels 使 PBO 工作?这是获得更好性能的正确解决方案吗?

0 投票
1 回答
271 浏览

ios - 使用 OpenGL ES 2.0 的 iOS 360 视频

我有一个使用 OpenGL ES 3.0 使用天空球实现播放 360 度视频的应用程序。我想使用 OpenGL ES 2.0 来支持更多的设备。

在 ViewController.swift 中,我在 setupContext() 方法中创建了 EAGLContext,它与 .OpenGLES3 一起使用,但是当我尝试使用 .OpenGLES2 时,我只看到黑屏。没有错误消息,我无法辨别 OpenGL ES 2.0 不支持哪些 API 函数。

如何使用 OpenGL ES 2.0 使用天空球体显示 360 度视频?主要实现在 Skysphere.swift 中。谢谢。

示例应用程序可在此处找到:https ://github.com/devinshively/TestVideoPlayer