I just found another useful trick. Originally I wanted to use OpenGL because the ModelView matrix makes it very easy to rotate objects in 3D. I found something very similar in android.graphics.camera which has three different routines for rotating (RotateX, RotateY, and RotateZ). Here is the code snippet from my project
// Member variables at top of class private float mYaw = 0; // Set these to whatever you like private float mRoll = 0; private float mPitch = 0; private Camera mCamera = new Camera(); @Override protected void dispatchDraw(Canvas canvas) { canvas.save(Canvas.MATRIX_SAVE_FLAG); // Save the current Camera matrix mCamera.save(); // Setup the camera rotations mCamera.rotateZ(-mYaw); mCamera.rotateY(-mRoll); mCamera.rotateX(-mPitch); // Output the camera rotations to a matrix mCamera.getMatrix(mMatrix); mCamera.restore(); // Perform some other transforms on the matrix mMatrix.preTranslate(-getWidth() * 0.5f, -getHeight() * 0.5f); mMatrix.postTranslate(getWidth() * 0.5f, getHeight() * 0.5f); // Apply the matrix to the canvas canvas.concat(mMatrix); // This code is from the MapViewCompassDemo mCanvas.delegate = canvas; super.dispatchDraw(mCanvas); canvas.restore(); } There you have it. Romain Guy, do you mean that OpenGL is not supported in the Canvas class? Surely it is still useful for rendering textures. Also, does anyone know what sort of GPU hardware (if any) will be in the G1? -Marc On Oct 12, 4:38 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote: > Rendering to OpenGL is a feature that got dropped for 1.0. Note that it > would simply render the same way as with a normal Canvas, it would not > automagically draw on an arbitrary mesh. > > On Oct 12, 2008 4:33 PM, "sandroid" <[EMAIL PROTECTED]> wrote: > > Yes, I'm getting some good results too. I also found out that you can > get a Bitmap of the MapView by do the following > > 1) Create a Bitmap > 2) Construct a Canvas with Bitmap as an input argument > 3) call something like mMapView.draw(canvas) and it will draw the view > to the canvas instead of to the screen. > > I noticed the Canvas constructor can also use a GL context. So does > that mean the MapView will render directly to the framebuffer? > Perhaps there is an easy way to render the MapView to the famous Utah > Teapot. > > http://en.wikipedia.org/wiki/Utah_teapot > > If anyone knows how to accomplish this I would be very impressed. > > On Oct 11, 5:16 pm, Esteem <[EMAIL PROTECTED]> wrote: > I just > experimented real quick on implim... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---