Transparent GLSurfaceView

Put your problem here if it does not fit any of the other categories.

Transparent GLSurfaceView

Postby carperto » Tue Nov 24, 2009 7:14 pm

The goal is to put some 3D objects on top of the camera.
I have created a Camera View and another smaller GLSurfaceView (wich renders the basic 3D Cube) on top of the camera preview.

I can see the 3d Cube spining correctly however it is framed inside its GLSurface, wich is black. I want these frame to be transparent in order to see the cubes as if they were spining on top of the camera preview.

Is this possible? No idea of OpenGL.
carperto
Junior Developer
Junior Developer
 
Posts: 12
Joined: Tue Feb 24, 2009 12:28 pm

Top

Postby carperto » Thu Nov 26, 2009 6:36 pm

I got it:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         setContentView(R.layout.main);
  3.  
  4.         setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  5.  
  6.        
  7.  
  8.         //Puesta en marcha de la superficie OpenGL
  9.  
  10.         mGLSurfaceView = (GLSurfaceView) findViewById(R.id.glsurfaceview);
  11.  
  12.         mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
  13.  
  14.         mGLSurfaceView.setRenderer(CubeRenderer.getInstance(true));
  15.  
  16.         mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  17.  
  18.        
  19.  
  20.         CameraView camara = new CameraView(this);
  21.  
  22.         addContentView(camara, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  23.  
  24.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
carperto
Junior Developer
Junior Developer
 
Posts: 12
Joined: Tue Feb 24, 2009 12:28 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 25 guests