android 如何取gpu信息???
发布网友
发布时间:2022-04-26 21:21
我来回答
共3个回答
热心网友
时间:2023-11-04 02:19
通过文档的查找,以及源码的剖析,Android的GPU信息需要通过OpenGL来获取,android framework层提供GL10来获取相应的参数,而GL10要在使用自定义的View时才可以获得,下面是获得GPU信息的例子:
1.实现Render类
[java] view plaincopy
class DemoRenderer implements GLSurfaceView.Renderer {
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
Log.d("SystemInfo", "GL_RENDERER = " +gl.glGetString(GL10.GL_RENDERER));
Log.d("SystemInfo", "GL_VENDOR = " + gl.glGetString(GL10.GL_VENDOR));
Log.d("SystemInfo", "GL_VERSION = " + gl.glGetString(GL10.GL_VERSION));
Log.i("SystemInfo", "GL_EXTENSIONS = " + gl.glGetString(GL10.GL_EXTENSIONS));
}
@Override
public void onDrawFrame(GL10 arg0) {
// TODO Auto-generated method stub
}
@Override
public void onSurfaceChanged(GL10 arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
}
}
2.实现GLSurfaceView
[java] view plaincopy
class DemoGLSurfaceView extends GLSurfaceView {
DemoRenderer mRenderer;
public DemoGLSurfaceView(Context context) {
super(context);
setEGLConfigChooser(8, 8, 8, 8, 0, 0);
mRenderer = new DemoRenderer();
setRenderer(mRenderer);
}
}
3.在Activity中 new 一个 DemoGLSurfaceView 对象
4.设置这个View对象
[java] view plaincopy
public class Demo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GLSurfaceView glView = new DemoGLSurfaceView(this);
this.setContentView(glView);
}
}
热心网友
时间:2023-11-04 02:20
内核的东西, 你需知道显卡的原理配置图。
热心网友
时间:2023-11-04 02:20
下一个systeminfo