ok to clarify. i understand that the map data is basically some images grouped in bounding boxes and drawn on a 2d canvas. is it possible to rotate the whole view so that it looks like on the image i posted from google earth, to get a kind of fly-over look? i know that there is a class in adroid used for 3d rotations on images(the camera class Graphics.camera)
There was a nice tutorial not long ago from sony-erricson with their 3d listview describing its functionality, but i don't think i can achieve what i need with it. is there a way that a view can be rendered maybe on a GL surface?
i realize that this isn't that simple to do but any suggestions or ideas on the matter can be helpful.
so where do i start?
tnx.
Very straightforward with OpenGL. Use triangles laid out in a huge grid and texture map accordingly, setup a camera and you are done. You even get elevations etc right with heightmapped terrain.
Related
I am trying to detect with OpenCv for Android hexagon fields of a map for a board game. The map looks something like that:
[Sample map]
I tried getting contours using only Value from HSV and I managed to get some of the hexagons, but unfortunately not all of them, I had mostly trouble detecting hexagons that had rivers or roads passing through them.
I managed to get something like that:
[Detected hexagons]
I even tried to make the borders thicker, but it didn't help a lot.
To detect all of the hexagons I thought of averaging the approximite size of the detected and then go on pixel by pixel trying to detect a change in the color (close to black). Later I would like to detect hexagons even on photos of a map, so then I couldn't really rely on the size of other hexagons.
What do you think would be the best way to solve this problem?
EDIT:
Thank you
I just began to implement your idea and it works great, for now i got the horizontal lines:
You deal with regular grid, so you just need to detect just a few, or even one, to compute all others. More will be better, because you'll be able to compute mean, and it will be more accurate. To find contours, it might be useful to find color gradient.
I m working on canvas. Here I just want to draw some geometric figures on canvas which may be resized according to the touch_move positions. By figures , I just meant triangle,rectangle,circle and some polygons. Is there a way to achieve this? . I haven't seen such apps which can draw these figures over canvas. So this seems to be complicated.. Thanks in advance
See this link.
If your application does not require a significant amount of processing or frame-rate speed (perhaps for a chess game, a snake game, or another slowly-animated application), then you should consider creating a custom View component and drawing with a Canvas in View.onDraw(). The most convenient aspect of doing so is that the Android framework will provide you with a pre-defined Canvas to which you will place your drawing calls.
I'm sure you can find some open-sourced out-of-the-box solutions for this if you tried a little.
If you actually want to learn something you should read the tutorials of per example;
-Custom Views
-OpenGL
After doing the tutorials, you'll have 2 ways to draw basic shapes, a triangle and a circle I believe, already done.
would be very grateful if anyone can advice how to solve the problem.
I got to draw a large and rather complicated structure (railway track layout). In order to have a smooth scrolling I wanted to draw the layout into a bitmap and then just to copy necessary part into the screen canvas in onDraw method.
The problem is that the layout is much larger than 2048x2048 (max allowed texture size on my Asus Prime) and I'm getting 'Bitmap too large to be uploaded into a texture'.
And this's even without zoom.
The layout is just a set of 2d geometrical primitives so maybe it's possible to work on geometrical rather than bitmap level, but how to implement smooth scroll and zoom then ?
What are common ways of solving this issue ?
Thanks in advance.
You should use a tiled approach. Divide your large map within small ones and render them while you move. Like google maps does.
You could use the TMX format: http://www.mapeditor.org/
AndEngine http://www.andengine.org/ has an implementation for it.
I'm trying to create a simple Pegs game. I have drawn the 15-hole board using canvas. I have been programming a while, but games are new to me and I'm stuck on what to do when it comes to handling the pegs. I want to only use the touch screen, but it seems like it is really difficult to touch the pegs and actually select them individually. I plan on just drawing everything programmatically. What is best way on handling this? Using buttons as place holders and changing the button image? Any help would be greatly appreciated.
To be very brief, you have to keep track of the things you draw on the canvas.
I wrote some tutorials for making and moving selectable shapes on the canvas. They should help a lot.
On android it might be a little different than using mousedown, but it should give you a very good starting place.
I don't know if this will help, but you might want to write your own onTouch()function. Check it out
I want to design a gameboard such as Checkers (but with the possibility of having different board tiles.
Now, OO logic and reason tell me I should have a 'tile' class which I can draw, and I draw x by y number of these on one canvas.
My question is what is the best performant way to draw such a board?
Is it reasonable to do it the way I mentioned above and re-draw on changes?
Is it better to have an image as my background and 'simulate' a board by snapping to where the tile would be?
Thanks!
I think you might benefit from checking out the snake game code for android. It has a very straight forward way of using tiles to make a game area.