I have a pr开发者_开发问答oblem retrieving OpenGL's info on Android.
I know I can get'em with gl.glGetString(GLxx.GL_VENDOR) but I don't know how to do it. Is there a way to retrieve them without showing anything on the SurfaceView?
I should create a page with the infos and set a textview with the info I need (eg. vendor, version, renderer).
Let me know if it's not clear and thank you guys!! :)
You have to make the call to glGetString on the rendering thread. You don't have to actually draw anything, it just needs to be called on the rendering thread.
I suggest using a GLSurfaceView, collecting all the possible information you need in onCreate with glGetString(GLxx.xyz)
, and then adding the information to some data structure that you can search at a later point. GLSurfaceView's methods like onCreate()
, onResume()
and onDraw()
, are all called on the rendering thread. With this approach, you will not have to call 'glGetString' on demand and therefore you will avoid issues with thread communication between the GL thread and the UI thread.
精彩评论