[android-beginners] Re: Manipulate 2D View in 3D OpenGL
Do not use the Context(GL) constructor, it is *not* supported. On Tue, Oct 14, 2008 at 9:42 AM, Anm <[EMAIL PROTECTED]> wrote: > > > 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, 5:25 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote: >> OpenGL is not supported by the Canvas. > > Romain, > > Can you detail what specifically was dropped. > > I have the code above running, transforming the rendering of the > MapView component into 3D (although the clipping needs to be adjusted > for the 3D view), but that code is not working at the OpenGL API > layers. I assume we can expect this to work on the G1. > > The Context( GL ) constructor says "some GL implementations may not > support antialiasing or certain effects". Is there any API to > determine what the underlying implementation supports. > > Anm > > > > -- Romain Guy www.curious-creature.org --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
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, 5:25 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote: > OpenGL is not supported by the Canvas. Romain, Can you detail what specifically was dropped. I have the code above running, transforming the rendering of the MapView component into 3D (although the clipping needs to be adjusted for the 3D view), but that code is not working at the OpenGL API layers. I assume we can expect this to work on the G1. The Context( GL ) constructor says "some GL implementations may not support antialiasing or certain effects". Is there any API to determine what the underlying implementation supports. Anm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
OpenGL is not supported by the Canvas. On Oct 12, 2008 5:11 PM, "sandroid" <[EMAIL PROTECTED]> wrote: 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 t... > On Oct 12, 2008 4:33 PM, "sandroid" <[EMAIL PROTECTED]> wrote: > > Yes, I'm getting some good ... --~--~-~--~~~---~--~~ You received this message because you are subs... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
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 implimenting the PolyToPoly method > to the MapViewCompassDemo.java APIDemo and it worked! > > I added mMatrix as a variable for the class: > private Matrix mMatrix = new Matrix(); > > added a concat call to the protected void dispatchDraw() function: > canvas.concat(mMatrix); > > and finally added the matrix transformation call to the end of the > onLaonLayout() function: > float src[] = new float[] { 0, 0, width, 0, width, height, 0, > height }; > float dst[] = new float[] { 0, 0, width, 0, width*2, height, -width, > height }; > mMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1); > > and here's what it looks like:http://censorednet.org/3dmapview.jpg > > On Oct 11, 4:39 pm, Esteem <[EMAIL PROTECTED]> wrote: > > > check out 3:10-3:20 of their video. I dont think thats street view. > > Also 5:35-6:00 where they specifically show driving directions in a 3D > > landscape mode :) > > > On Oct 11, 8:10 am, Fugita <[EMAIL PROTECTED]> wrote: > > > > actually they are using the street view and I think this means it is > > > only possible were street view can be used. > > > > On Oct 11, 3:11 am, Esteem <[EMAIL PROTECTED]> wrote: > > > > > Enkin's (http://www.enkin.net/) "landscape mode" does this. I'm not > > > > sure what method is used or anything but its possible. > > > > > But check out the PolyToPoly API Graphics demo which shows how to > > > > transform a canvas to make it look 3D without opengl. I havnt really > > > > looked over MapView to see if this method is possible, but if it can > > > > be applied to MapView, i think it would do the trick. > > > > > On Oct 9, 1:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > Is there a way to take the frame from a view, such as the MapView, > > > > > and manipulate it in 3D with OpenGL. For example, I have a MapView > > > > > which shows a particular location and I want to treat this as a 2D > > > > > plane in 3D so that I can rotate the plane along the y or x axis. > > > > > Right now I have no idea how to approach this problem. My initial > > > > > idea is to somehow render the output from MapView to a texture, and > > > > > then render that texture to the screen using OpenGL. > > > > > > I got the idea from looking at the app Marvin, where the MapView looks > > > > > like a plane receding into the horizon. > > > > > > -Marc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
I just experimented real quick on implimenting the PolyToPoly method to the MapViewCompassDemo.java APIDemo and it worked! I added mMatrix as a variable for the class: private Matrix mMatrix = new Matrix(); added a concat call to the protected void dispatchDraw() function: canvas.concat(mMatrix); and finally added the matrix transformation call to the end of the onLaonLayout() function: float src[] = new float[] { 0, 0, width, 0, width, height, 0, height }; float dst[] = new float[] { 0, 0, width, 0, width*2, height, -width, height }; mMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1); and here's what it looks like: http://censorednet.org/3dmapview.jpg On Oct 11, 4:39 pm, Esteem <[EMAIL PROTECTED]> wrote: > check out 3:10-3:20 of their video. I dont think thats street view. > Also 5:35-6:00 where they specifically show driving directions in a 3D > landscape mode :) > > On Oct 11, 8:10 am, Fugita <[EMAIL PROTECTED]> wrote: > > > actually they are using the street view and I think this means it is > > only possible were street view can be used. > > > On Oct 11, 3:11 am, Esteem <[EMAIL PROTECTED]> wrote: > > > > Enkin's (http://www.enkin.net/) "landscape mode" does this. I'm not > > > sure what method is used or anything but its possible. > > > > But check out the PolyToPoly API Graphics demo which shows how to > > > transform a canvas to make it look 3D without opengl. I havnt really > > > looked over MapView to see if this method is possible, but if it can > > > be applied to MapView, i think it would do the trick. > > > > On Oct 9, 1:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > Is there a way to take the frame from a view, such as the MapView, > > > > and manipulate it in 3D with OpenGL. For example, I have a MapView > > > > which shows a particular location and I want to treat this as a 2D > > > > plane in 3D so that I can rotate the plane along the y or x axis. > > > > Right now I have no idea how to approach this problem. My initial > > > > idea is to somehow render the output from MapView to a texture, and > > > > then render that texture to the screen using OpenGL. > > > > > I got the idea from looking at the app Marvin, where the MapView looks > > > > like a plane receding into the horizon. > > > > > -Marc > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
check out 3:10-3:20 of their video. I dont think thats street view. Also 5:35-6:00 where they specifically show driving directions in a 3D landscape mode :) On Oct 11, 8:10 am, Fugita <[EMAIL PROTECTED]> wrote: > actually they are using the street view and I think this means it is > only possible were street view can be used. > > On Oct 11, 3:11 am, Esteem <[EMAIL PROTECTED]> wrote: > > > Enkin's (http://www.enkin.net/) "landscape mode" does this. I'm not > > sure what method is used or anything but its possible. > > > But check out the PolyToPoly API Graphics demo which shows how to > > transform a canvas to make it look 3D without opengl. I havnt really > > looked over MapView to see if this method is possible, but if it can > > be applied to MapView, i think it would do the trick. > > > On Oct 9, 1:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > Is there a way to take the frame from a view, such as the MapView, > > > and manipulate it in 3D with OpenGL. For example, I have a MapView > > > which shows a particular location and I want to treat this as a 2D > > > plane in 3D so that I can rotate the plane along the y or x axis. > > > Right now I have no idea how to approach this problem. My initial > > > idea is to somehow render the output from MapView to a texture, and > > > then render that texture to the screen using OpenGL. > > > > I got the idea from looking at the app Marvin, where the MapView looks > > > like a plane receding into the horizon. > > > > -Marc > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
actually they are using the street view and I think this means it is only possible were street view can be used. On Oct 11, 3:11 am, Esteem <[EMAIL PROTECTED]> wrote: > Enkin's (http://www.enkin.net/) "landscape mode" does this. I'm not > sure what method is used or anything but its possible. > > But check out the PolyToPoly API Graphics demo which shows how to > transform a canvas to make it look 3D without opengl. I havnt really > looked over MapView to see if this method is possible, but if it can > be applied to MapView, i think it would do the trick. > > On Oct 9, 1:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > > > Hi, > > Is there a way to take the frame from a view, such as the MapView, > > and manipulate it in 3D with OpenGL. For example, I have a MapView > > which shows a particular location and I want to treat this as a 2D > > plane in 3D so that I can rotate the plane along the y or x axis. > > Right now I have no idea how to approach this problem. My initial > > idea is to somehow render the output from MapView to a texture, and > > then render that texture to the screen using OpenGL. > > > I got the idea from looking at the app Marvin, where the MapView looks > > like a plane receding into the horizon. > > > -Marc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
Enkin's (http://www.enkin.net/) "landscape mode" does this. I'm not sure what method is used or anything but its possible. But check out the PolyToPoly API Graphics demo which shows how to transform a canvas to make it look 3D without opengl. I havnt really looked over MapView to see if this method is possible, but if it can be applied to MapView, i think it would do the trick. On Oct 9, 1:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > Hi, > Is there a way to take the frame from a view, such as the MapView, > and manipulate it in 3D with OpenGL. For example, I have a MapView > which shows a particular location and I want to treat this as a 2D > plane in 3D so that I can rotate the plane along the y or x axis. > Right now I have no idea how to approach this problem. My initial > idea is to somehow render the output from MapView to a texture, and > then render that texture to the screen using OpenGL. > > I got the idea from looking at the app Marvin, where the MapView looks > like a plane receding into the horizon. > > -Marc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
If you get this up and running I know I would like to see a copy of it. I am really looking for something to replace my MobileNavigator from Navigon. And it would seem that none of the navigation software companies are going to support Android since when I asked if they would they all said.. "At this time we have no projects in the works to support the Google Android OS." On Oct 10, 11:36 am, sandroid <[EMAIL PROTECTED]> wrote: > Yes, that's the right idea. Right now I'm looking into the > getDrawingCache() routine which returns a bitmap. Then I might load > that bitmap into a view with OpenGL enabled. Unfortunately, the only > code examples I have found for getDrawingCache() are only snippets of > code and I can't tell when or where I should call the routine. > > On Oct 10, 12:14 am, Fugita <[EMAIL PROTECTED]> wrote: > > > Hey if you get this to work then maybe we can get something like a 3D > > turn by turn driving direction program for Google finally! > > > On Oct 9, 3:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > Is there a way to take the frame from a view, such as the MapView, > > > and manipulate it in 3D with OpenGL. For example, I have a MapView > > > which shows a particular location and I want to treat this as a 2D > > > plane in 3D so that I can rotate the plane along the y or x axis. > > > Right now I have no idea how to approach this problem. My initial > > > idea is to somehow render the output from MapView to a texture, and > > > then render that texture to the screen using OpenGL. > > > > I got the idea from looking at the app Marvin, where the MapView looks > > > like a plane receding into the horizon. > > > > -Marc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
Yes, that's the right idea. Right now I'm looking into the getDrawingCache() routine which returns a bitmap. Then I might load that bitmap into a view with OpenGL enabled. Unfortunately, the only code examples I have found for getDrawingCache() are only snippets of code and I can't tell when or where I should call the routine. On Oct 10, 12:14 am, Fugita <[EMAIL PROTECTED]> wrote: > Hey if you get this to work then maybe we can get something like a 3D > turn by turn driving direction program for Google finally! > > On Oct 9, 3:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > > > Hi, > > Is there a way to take the frame from a view, such as the MapView, > > and manipulate it in 3D with OpenGL. For example, I have a MapView > > which shows a particular location and I want to treat this as a 2D > > plane in 3D so that I can rotate the plane along the y or x axis. > > Right now I have no idea how to approach this problem. My initial > > idea is to somehow render the output from MapView to a texture, and > > then render that texture to the screen using OpenGL. > > > I got the idea from looking at the app Marvin, where the MapView looks > > like a plane receding into the horizon. > > > -Marc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Manipulate 2D View in 3D OpenGL
Hey if you get this to work then maybe we can get something like a 3D turn by turn driving direction program for Google finally! On Oct 9, 3:23 pm, sandroid <[EMAIL PROTECTED]> wrote: > Hi, > Is there a way to take the frame from a view, such as the MapView, > and manipulate it in 3D with OpenGL. For example, I have a MapView > which shows a particular location and I want to treat this as a 2D > plane in 3D so that I can rotate the plane along the y or x axis. > Right now I have no idea how to approach this problem. My initial > idea is to somehow render the output from MapView to a texture, and > then render that texture to the screen using OpenGL. > > I got the idea from looking at the app Marvin, where the MapView looks > like a plane receding into the horizon. > > -Marc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---