Search code examples
androidopengl-esglsurfaceview

Keeping a reference to gl in GLSurfaceView::onSurfaceCreated?


Is it safe to keep a reference to the GL10 gl parameter when GLSurfaceView::onSurfaceCreated is called?

I'd like to initialize textures at some point later than the onSurfaceCreated but I don't know now, so I wondered if just keeping a reference to it is ok.


Solution

  • I think that is generally a bad idea. You can bind textures in GLSurfaceView.Renderer::onDrawFrame.