Get GPU info on Android without SurfaceView

本秂侑毒 提交于 2019-12-10 16:07:46

问题


On Android, is there a way to get GPU information without creating a SurfaceView? I'm not looking to draw anything using OpenGL, but I just need to get hardware information like vendor, OpenGL ES version, extensions available etc.


回答1:


I am sorry I am not sure how to do that with Android but the function glGetString allows you to access the OpenGL information. Here is a sample C++ style code that will output the extensions supported by your hardware that I hope you'll be able to adapt to Android:

void PrettyPrintExtensions(){
    std::string extensions = (const char*) glGetString(GL_EXTENSIONS);
    char* extensionStart = &extensions[0];
    char** extension = &extensionStart;
    std::cout << "Supported OpenGL ES Extensions:" << std::endl;
    while (*extension)
        std::cout << '\t' << strsep(extension, " ") << std::endl;
    std::cout << std::endl;
}

By changing the parameter of glGetString you can also access the Vendor, renderer and version. Please see:

http://www.khronos.org/opengles/sdk/1.1/docs/man/glGetString.xml



来源:https://stackoverflow.com/questions/8442720/get-gpu-info-on-android-without-surfaceview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!