小编dei*_*iva的帖子

Opengl开发GPU依赖吗?

我在opengl ES2.0中开发了一个android应用程序.在这个应用程序中,我曾经通过GL surfaceView中的触摸事件绘制多个线条和圆圈.

由于opengl依赖于GPU,目前它在Google Nexus 7(ULP GeForce)中运行良好.

在三星Galaxy Note 2(MALI 400MP)中,我试图绘制多条线,但它清除了前一条线,并将当前线绘制为新线.

在Sony Xperia Neo V(Adreno 205)中,我试图画一条新线,它会使表面崩溃,如下图所示.在此输入图像描述

是否可以使其在所有设备上运行,或者我是否需要为单个GPU编写代码?


源代码

MainActivity.java

//in OnCreate method of my activity, i set the glsurfaceview and renderer

final ActivityManager activityManager =
    ( ActivityManager ) getSystemService( Context.ACTIVITY_SERVICE );
final ConfigurationInfo configurationInfo =
    activityManager.getDeviceConfigurationInfo(  );
final boolean supportsEs2 = ( configurationInfo.reqGlEsVersion >= 0x20000
                  || Build.FINGERPRINT.startsWith( "generic" ) );

if( supportsEs2 ) {
    Log.i( "JO", "configurationInfo.reqGlEsVersion:"
           + configurationInfo.reqGlEsVersion + "supportsEs2:"
           + supportsEs2 );
// Request an OpenGL ES 2.0 …
Run Code Online (Sandbox Code Playgroud)

android gpu opengl-es-2.0

6
推荐指数
1
解决办法
1242
查看次数

标签 统计

android ×1

gpu ×1

opengl-es-2.0 ×1