Thank you Julius,

Unfortunately, I cannot it get it work as I use the emulator (SDK 1.5
r1) (and do not have any device)

The emulator does not handle the transparency format (http://
groups.google.com/group/android-developers/browse_thread/thread/
7d18f1b3480ff242)

I only get a blank screen with a small part of the screen below
showing the camera preview.

Did anyone try on older version of the emulator ?

If it works fine on devices, I can still work on it disabling
temporary the line: mGLSurfaceView.getHolder().setFormat
(PixelFormat.TRANSLUCENT);
And enabling it when I plan to distribute it on devices...


On Jun 12, 7:15 am, julius <[email protected]> wrote:
> Hi,
>
> Sorry I didn't see the replies til now. The Preview code I grabbed
> from somewhere in the forum. It may not be the correct way to do it,
> but it seems to work. Anyone know much about how to use quarternions
> in Java?
>
> I did it a bit back to front:
>
> Find TranslucentGLSurfaceViewActivity in the Demos,
>
> Then add (in onCreate):
>
> mPreview = new Preview(this);
> addContentView(mPreview, new LayoutParams(LayoutParams.WRAP_CONTENT,
> LayoutParams.WRAP_CONTENT));
>
> and add the member variable:
> private Preview mPreview;
>
> class Preview extends SurfaceView implements SurfaceHolder.Callback {
>   SurfaceHolder mHolder;
>  CameramCamera;
>
>   Preview(Context context) {
>       super(context);
>
>       // Install a SurfaceHolder.Callback so we get notified when the
>       // underlying surface is created and destroyed.
>       mHolder = getHolder();
>       mHolder.addCallback(this);
>       mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
>   }
>
>   public void surfaceCreated(SurfaceHolder holder) {
>       // The Surface has been created, acquire thecameraand tell it
> where
>       // to draw.
>       mCamera =Camera.open();
>       mCamera.setPreviewDisplay(holder);
>   }
>
>   public void surfaceDestroyed(SurfaceHolder holder) {
>       // Surface will be destroyed when we return, so stop the
> preview.
>       // Because the CameraDevice object is not a shared resource,
> it's very
>       // important to release it when the activity is paused.
>       mCamera.stopPreview();
>       mCamera = null;
>   }
>
>   public void surfaceChanged(SurfaceHolder holder, int format, int w,
> int h) {
>       // Now that the size is known, set up thecameraparameters and
> begin
>       // the preview.
>      Camera.Parameters parameters = mCamera.getParameters();
>       parameters.setPreviewSize(w, h);
>       mCamera.setParameters(parameters);
>       mCamera.startPreview();
>   }
>
> }
>
> Regards,
> Julius.
>
> http://www.juliusspencer.co.nz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to