Alternative approach to OpenGL View on top of Camera
Posted
by
Mr. Roland
on Stack Overflow
See other posts from Stack Overflow
or by Mr. Roland
Published on 2011-01-04T21:51:26Z
Indexed on
2011/01/04
21:53 UTC
Read the original article
Hit count: 295
Hi,
the traditional way of doing a camera preview background with OpenGL on the front is to take two SurfaceViews(one for the camera another for OpenGL) and stack them on top of each other. The problem is that stacking SurfaceViews is discouraged:
http://groups.google.com/group/android-developers/browse_thread/thread/4850fe5c314a3dc6
So what alternatives are there? I was considering the following:
- Subclass GlSurfaceView, and then call set the Camera preview onto the holder of this subclass: Camera.setPreviewDisplay(mHolder);
- Don't use GLSurfaceView, instead create your own SurfaceView subclass where you display the Camera preview onto the holder and also draw your openGL. This would require to use OpenGL without GLSurfaceView, has anyone done this before?
I'm not sure if this even is possible or makes sense, since it implies displaying the camera preview onto the holder of the surface and at the same time drawing OpenGL on the same surface. Is there any other sensible alternative to solving the problem without using two SurfaceViews?
Thanks!
© Stack Overflow or respective owner