为什么我的OpenGL输出不同的各种设备? [英] Why my opengl output differs for various devices?

查看:175
本文介绍了为什么我的OpenGL输出不同的各种设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用GLSurfaceView在OpenGLES 2.0像AUTO CAD应用程序创建一个Android应用程序为线图,圆圈......。

该应用程序可以很好地处理谷歌Nexus 7,因为如果我们画一条线和放大器的意识;然后一个圆行不会被抹去表面观。但随着三星Galaxy Note II,这是完全不同的。

该行$ P $一圈之前pviously画被吸引,被擦除。也就是说,每个如果我们画一条新的生产线或圆的时候,previous一个得到erased.I可以一次只绘制一个图像。我需要的是我得到了谷歌Nexus 7的三星Galaxy相同的输出注意II.ieI要绘制多个图像中的GLSurfaceView的时间。

请注意: 无论是在谷歌Nexus 7和三星Galaxy Note II的Andr​​oid操作系统是果冻豆4.2。但是,这两个设备是不同的GPU。谷歌Nexus 7的GPU的GeForce ULP和放大器;三星Galaxy Note II是Mali400MP。

这将是在Surfaceview?

输出的渲染问题

如果我们考虑到GPU,而编码?

谁能告诉我,为什么在不同的设备不同的输出的这个问题呢?

解决方案
  

如果我们考虑到GPU,而编码?没办法,OpenGL的API是应用程序和硬件之间的一层。

这在很大程度上是正确的桌面图形,因为所有的GPU渲染器立竿见影,但是,这是不是在移动图形的情况。

在马里的GPU采用基于区块的即时模式渲染。 对于这种类型的渲染,帧缓冲区是由16个像素分成大小16瓦。多边形列表生成器(PLB)从应用程序到多边形名单组织的输入数据。有一个多边形列表每一瓦片。当一个原始覆盖瓦片,一个条目,称为多边形列表命令的一部分,被加入到多边形列表为瓷砖。 像素处理器采用多边形名单一瓦,并在下次的瓷砖开始工作之前,计算出在这片所有的像素值。由于这种基于瓦片的方法使用了一种快速,片片缓冲器中,GPU仅在每个瓦片的末端写入瓦片缓冲器内容在主存储器中的帧缓冲。非瓷砖为主,直接模式渲染器通常需要更多的帧缓冲访问。因此,基于区块的方法消耗更少的内存带宽,并支持操作,例如深度测试,混合,抗锯齿有效

另一个区别是呈现缓冲区的治疗。即时渲染器将拯救你的缓冲区的内容,有效地让你只绘制在什么previously存在顶部渲染场景的差异。这是在马里提供,但是,是不是默认启用的,因为它可以如果使用不当,会造成不良影响。

有关于如何使用EGL preserve在GLES2 SDK的这里

原因的GeForce ULP基于Nexus 7保护的作品如预期的是,作为直接基于渲染器,则默认为preserving缓冲区,而马里则没有。

从Khronos的EGL规格:

  

EGL_SWAP_BEHAVIOR

     

指定的张贴表面eglSwapBuffers的颜色缓冲的效果。 EGL_BUFFER_ preSERVED的值表示颜色缓冲区内容不变,而EGL_BUFFER_DESTROYED表示颜色缓冲区的内容可以由操作被破坏或改变。<​​/ P>      

* EGL_SWAP_BEHAVIOR的初始值的选择是通过实施。*

有关EGL_SWAP_BEHAVIOUR马里平台上的默认值EGL_BUFFER_DESTROYED。这是由于用具有呈现新帧之前来从存储器中的previous缓冲液中,将其存储在末尾,以及带宽的消耗(这也是非常糟糕的电池寿命上移动相关联的性能损失设备)。我不能肯定为不过是Tegra片上系统的默认行为发表评论,很明显,我认为他们的默认值是EGL_BUFFER_ preSERVED。

要澄清马里的地位与问候Khronos的GLES规格 - 马里是完全符合

I have created an android app for drawing of lines,circles.. by using GLSurfaceView in OpenGLES 2.0 like an Auto cad app.

The app works well with Google Nexus 7, in the sense that if we draw a line & then a circle the line doesn't get erased in surface view. But with Samsung Galaxy Note II, it is entirely different.

The line previously drawn before a circle being drawn, gets erased. i.e., each time if we draw a new line or circle, the previous one gets erased.I can draw only one image at a time. What I need is the same output which I get in Google Nexus 7 in Samsung Galaxy Note II.i.e.I want to draw more than one image in the GLSurfaceView at a time.

Note : Both the Android OS in Google Nexus 7 and Samsung Galaxy Note II are Jelly Bean 4.2. But both devices are different GPU. Google Nexus 7 GPU is ULP GeForce & Samsung Galaxy Note II is Mali400MP.

Would this be an issue in the rendering of output of the Surfaceview ?

Should we take into account of GPU while Coding ?

Can anyone tell me why this problem of different output in different devices ?

解决方案

Should we take into account of GPU while Coding ? No way, The OpenGL API is a layer between your application and the hardware.

This is largely correct for desktop graphics as all GPUs are immediate renderers, however, this is NOT the case in mobile graphics.

The Mali GPUs use tile-based immediate-mode rendering. For this type of rendering, the framebuffer is divided into tiles of size 16 by 16 pixels. The Polygon List Builder (PLB) organizes input data from the application into polygon lists. There is a polygon list for each tile. When a primitive covers part of a tile, an entry, called a polygon list command, is added to the polygon list for the tile. The pixel processor takes the polygon list for one tile and computes values for all pixels in that tile before starting work on the next tile. Because this tile-based approach uses a fast, on-chip tile buffer, the GPU only writes the tile buffer contents to the framebuffer in main memory at the end of each tile. Non-tiled-based, immediate-mode renderers generally require many more framebuffer accesses. The tile-based method therefore consumes less memory bandwidth, and supports operations such as depth testing, blending and anti-aliasing efficiently.

Another difference is the treatment of rendered buffers. Immediate renderers will "save" the content of your buffer, effectively allowing you to only draw differences in the rendered scene on top of what previously existed. This IS available in Mali, however, is not enabled by default as it can cause undesired effects if used incorrectly.

There is a Mali GLES2 SDK example on how to use "EGL Preserve" Correctly available in the GLES2 SDK here

The reason the Geforce ULP based nexus 7 works as intended is that, as an immediate based renderer, it defaults to preserving the buffers, whereas Mali does not.

From the Khronos EGL specification:

EGL_SWAP_BEHAVIOR

Specifies the effect on the color buffer of posting a surface with eglSwapBuffers. A value of EGL_BUFFER_PRESERVED indicates that color buffer contents are unaffected, while EGL_BUFFER_DESTROYED indicates that color buffer contents may be destroyed or changed by the operation.

*The initial value of EGL_SWAP_BEHAVIOR is chosen by the implementation.*

The default value for EGL_SWAP_BEHAVIOUR on the Mali platform is EGL_BUFFER_DESTROYED. This is due to the performance hit associated with having to fetch the previous buffer from memory before rendering the new frame, and storing it at the end as well as the consumption of bandwidth (which is also incredibly bad for battery life on mobile devices). I am unable to comment with certainty as to the default behavior of the Tegra SoCs however, it is apparent to me that their default is EGL_BUFFER_PRESERVED.

To clarify Mali's position with regards to the Khronos GLES specifications - Mali is fully compliant.

这篇关于为什么我的OpenGL输出不同的各种设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆