刚接触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

}

});


更多相关文章

  1. android listview 与 一般多线程配合产生的错误,资料汇总
  2. 文件多线程下载实现
  3. android使用多线程处理
  4. Android中通过其他线程更新主线程UI
  5. Android初始化OpenGL ES,并且分析Renderer子线程原理
  6. Android主线程、子线程通信(Thread+handler)

随机推荐

  1. Android(安卓)核心分析 之八------Androi
  2. Android中的消息机制:Handler消息传递机制
  3. Android中的多媒体编程-黄俊东-专题视频
  4. 开发具备语音识别功能的 Android* 应用
  5. android 屏幕自适应
  6. 【Android布局】在程序中设置android:gra
  7. android的Instrumentation详解
  8. Android在Eclipse环境下安装配置
  9. Android中横竖屏切换的问题
  10. Android(安卓)应用程序之间数据共享—Con