title: How to replace GLSurfaceView with TextureView in Android Ice Cream Sandwich?
body: <p>The TextureView <a href="http://developer.android.com/reference/android/view/TextureView.html" rel="noreferrer">documentation</a> states that it can be used to render OpenGL content. </p>
  
  <p>In the <a href="http://android-developers.blogspot.com/2011/11/android-40-graphics-and-animations.html" rel="noreferrer">blog post</a> announcing TextureView, it states: </p>
  
  <blockquote>
    <p>A TextureView can just as easily be used to embed an OpenGL scene in your application. As of Android 4.0, eglCreateWindowSurface() can be used to render into a SurfaceTexture object.</p>
  </blockquote>
  
  <p>Which seems to imply that to use TextureView instead of GLSurfaceView, one would have to do all the EGL setup themselves and manage the EGLContext and the threading (since GLSurfaceView maintains a GLThread). There doesn't seem to be any sample code in the Android 4.0 SDK that demonstrates how the "<em>TextureView can just as easily be used to embed an OpenGL scene</em>". TextureView seems to plug in more cleanly to the Camera preview (setPreviewTexture) and MediaPlayer (setSurface).</p>
  
  <p>Is it possible to use GLSurfaceView in conjunction with TextureView by using GLSurfaceView.setEGLWindowSurfaceFactory to make it render to the TextureView's SurfaceTexture?</p>
  
  <p>Again, it would be nice if there were some sample code.</p>