android纹理

来源:互联网 发布:淘宝网狗狗宠物店 编辑:程序博客网 时间:2024/05/19 13:59

刚接触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(){  

publicvoid run() {

// dosomething

}

});


0 0