简体   繁体   English

Open gl es - 如何提高性能,渲染纹理,混合

[英]Open gl es - How to improve performance, render to texture, blending

I am here because I'm working on an OpenGL program and I have some issues with performance. 我在这里是因为我正在开发一个OpenGL程序,而且我在性能方面存在一些问题。 I work with OpenGL ES 3.0 on iMX6 soc. 我在iMX6 soc上使用OpenGL ES 3.0。

Here is my algorithm : 这是我的算法:

  1. I get an image from camera which is directly map to a texture. 我从相机获得一个直接映射到纹理的图像。 Using an FBO, I render to texture to map the image on a specific form. 使用FBO,我渲染到纹理以在特定表单上映射图像。

  2. I do the same thing (with a second FBO) for another image which is sent via shared memory by another application. 我为另一个图像执行相同的操作(使用第二个FBO),该图像由另一个应用程序通过共享内存发送。 This step is performed only if the image is updated. 仅在更新图像时才执行此步骤。 Only once per second. 每秒只有一次。

  3. I blend these two textures in the default frame buffer to render the result to the screen. 我将这两个纹理混合在默认的帧缓冲区中,以将结果呈现给屏幕。

If I perform these three steps separately, It works well and the screen is updated at 30FPS. 如果我单独执行这三个步骤,它运行良好,屏幕更新为30FPS。 But when I include the three step in one program the render is very slow and I got only 0.5FPS. 但是当我在一个程序中包含三步时,渲染非常慢,而我只有0.5FPS。

I am wondering if the GPU on the iMX6 is enough powerful, but I think it is not a complex algorithm. 我想知道iMX6上的GPU是否足够强大,但我认为它不是一个复杂的算法。 I think I am doing something in the wrong way, but what? 我想我正在以错误的方式做某事,但是什么呢? I use 3 different frame buffers, so is that a good way or should I use only one? 我使用3个不同的帧缓冲区,这是一个好方法还是应该只使用一个?

Can someone give me answer, clues, anything that can help me? 有人可以给我答案,线索,任何可以帮助我的东西吗? :-) :-)

My images dimensions are 1280x1024 x RGBA. 我的图片尺寸为1280x1024 x RGBA。 Then I am doing some conversion from floating-point texture to integer and back to float, this is done to perform bitwise operation on pixels. 然后我正在做一些从浮点纹理到整数并返回到浮点数的转换,这是为了对像素执行按位运算。

Thanks to @Columbo the problem came from all the conversion, I work with floating-point texture and only for the bitwise operations I do the conversion which improve a lot the performance of the algorithm. 感谢@Columbo,问题来自于所有转换,我使用浮点纹理,并且只针对按位操作我进行转换,这提高了算法的性能。

Another point which decrease the performance was the texture format. 降低性能的另一点是纹理格式。 For the first step, the image was 1280x1024 but only on one composent (grayscale image). 第一步,图像为1280x1024,但仅限于一个组合图像(灰度图像)。 To keep only the grayscale composant and not to use too much memory I worked with a GL_RED texture but this wasn't a good idea because when I changed it to GL_RGB, I double the framerate of the render too. 为了保留灰度合成器并且不使用太多内存,我使用了GL_RED纹理,但这不是一个好主意,因为当我将其更改为GL_RGB时,我也将渲染的帧速率加倍。

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

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