android纹理

刚接触android不久,遇到glGenTextures一直返回为0的问题, 百度&google了很久都没有找到原因。

翻看GLSurfaceView的文档,发现The renderer will be called on a separate thread, so that rendering performance is decoupled from the UI thread. Clients typically need to communicate with the renderer from the UI thread, because that's where input events are received. Clients can communicate using any of the standard Java techniques for cross-thread communication, or they can use the queueEvent(Runnable) convenience method.

注意,一定要在opengl的那个线程里面去申请纹理id。

在GLSurfaceView有一个方法queueEvent。


queueEvent(new Runnable(){  

public void run() {

// dosomething

}

});


你可能感兴趣的:(android纹理)