OpenGL ES纹理流或映射

时间:2022-02-09 05:00:15

Situation

I have a video stream coming from a native library in iOS. I'm trying to display the image in an iPhoneOSGameView using glTexImage2D and glTexSubImage2D for updates. I can update subregions of the image, I receive a structure that tells me which rectangle has to be updated on the gpu.

我有一个来自iOS本地库的视频流。我正在尝试使用glTexImage2D和glTexSubImage2D在iPhoneOSGameView中显示图像以进行更新。我可以更新图像的子区域,我收到一个结构,告诉我哪个矩形必须在gpu上更新。

The issue

Framerate is quite low. After much profiling both in OpenGLES and the application code, I have concluded that the application usually is waiting on the texture upload. The slow function is glClear, but I suspect there's an intrinsic glFlush in there.

帧率很低。在对OpenGLES和应用程序代码进行大量分析之后,我得出结论,应用程序通常在等待纹理上传。缓慢的功能是glClear,但我怀疑那里有一个内在的glFlush。

My question

I've seen some people talking about glMapBuffer that could allow me to stream the video directly to the texture in user-space. I've looked at pixel buffer objects, but they require OpenGLES 3.0 or an extension in 2.0. Is there an efficient way (for mobile) to stream a texture with minimal memory copying OR a way to transfer the texture from different thread?

我见过一些人在谈论glMapBuffer,它可以让我直接将视频流式传输到用户空间中的纹理。我看过像素缓冲区对象,但它们需要OpenGLES 3.0或2.0中的扩展。是否有一种有效的方式(移动)以最小的内存复制流式传输纹理或从不同的线程传输纹理的方法?

Additional information

I'm working in C# Xamarin and I'm testing on different devices such as an iPod Touch Gen3, a iPad Air 2 and a iPad Pro 12".

我在C#Xamarin工作,我正在测试不同的设备,如iPod Touch Gen3,iPad Air 2和iPad Pro 12“。

1 个解决方案

#1


0  

there an efficient way (for mobile) to stream a texture with minimal memory copying

有一种有效的方式(用于移动)以最小的内存复制流式传输纹理

Most operating systems have some media framework which allows import of images directly using the EGL_image_external extension avoiding the need to upload. I'm not sure how it works on iOS, but I strongly suspect it should be possible. It's OS-specific unfortunately, so no standard way of doing it.

大多数操作系统都有一些媒体框架,允许使用EGL_image_external扩展直接导入图像,避免上传。我不确定它在iOS上是如何工作的,但我强烈怀疑它应该是可行的。不幸的是,它是特定于操作系统的,所以没有标准的方法。

OR a way to transfer the texture from different thread?

或者从不同的线程转移纹理的方法?

Just create two GL Contexts in the same share group.

只需在同一个共享组中创建两个GL上下文。

https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ConcurrencyandOpenGLES/ConcurrencyandOpenGLES.html

#1


0  

there an efficient way (for mobile) to stream a texture with minimal memory copying

有一种有效的方式(用于移动)以最小的内存复制流式传输纹理

Most operating systems have some media framework which allows import of images directly using the EGL_image_external extension avoiding the need to upload. I'm not sure how it works on iOS, but I strongly suspect it should be possible. It's OS-specific unfortunately, so no standard way of doing it.

大多数操作系统都有一些媒体框架,允许使用EGL_image_external扩展直接导入图像,避免上传。我不确定它在iOS上是如何工作的,但我强烈怀疑它应该是可行的。不幸的是,它是特定于操作系统的,所以没有标准的方法。

OR a way to transfer the texture from different thread?

或者从不同的线程转移纹理的方法?

Just create two GL Contexts in the same share group.

只需在同一个共享组中创建两个GL上下文。

https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ConcurrencyandOpenGLES/ConcurrencyandOpenGLES.html