Zoom in to a Large Map

Started by
3 comments, last by ksearle 20 years, 3 months ago
Problem : I have a large map file (could be between 1600-5000 pixels wide and high) and would like to be able to zoom in gradually in real time starting with the whole map fitting on the screen at once and being able to zoom in to a spot at true map resolution. What I have tried : With GDI+ I can display 800x600 maps fine and draw on them precisely, but it is not fast enough for any movement or real time zooms so I am looking at DirectX options. I have tried a direct draw surface but can not find a way to zoom the map out to full screen or change the scale at all. It shows up at map resolution (zoomed in), but without being able to scale it, it would not suit my goals. I have read some messages refering to Direct3d Sprites and breaking a map into powers of 2 with pieces of max size of 256x256, but piecing it all back together in 3d and then being able to draw to a precise point on the map sounds complicated. Question: So does anyone know what approach is good for zooming in and out of large maps and being able to draw on them in 2D. One thought I have is to load it all at once to a flat surface first, do the 2D Drawing, and then move it to 3d sprites for displaying? The Map will essentially be a 2D background image with other 2D images like menus over it in the foreground. I hope my next application will be in 3D.
Advertisement
5000x5000 is ~75Mb worth of data... If your target hw has that, you can just split it up and that''ll be that.

If not, I think I''d spend the ~30% extra and generate the mipmaps. Then you''ll only be drawing with a couple of screens worth of texture data. When you paint on it you''ll need to update the mipmaps as well. Shouldn''t take too long, and you can maintain something of a framerate. Clears and other "full map" operations will be slower, though.

-Morten-
Yesterday, I was able to display a map of 1600x1200 at any zoom level just using a surface and the Draw command to the back buffer and I am pleased with the results on my card. But a 35MB file does not appear correctly (distorted or stretched in the middle). I am guessing it''s because I have a 32MB card and the 35MB file exceeded my card''s memory?

I think the people viewing my application will be very low range video cards and could be non gaming PCs up to 5 years old so this is not a good sign. I am worried that even a 1600x1200 map would be problem on their cards using this approach.

I guess I am not sure what memory limits a surface has and if there is a way to use other memory for older cards. I can make zoom animation optional for older cards as long as I can get the map to display.

I will have to find a Direct X Solution this week or I will have to stay with GDI+ for this project. Thanks for any ideas.
Split the image up. Then you can have a couple hundred MB of image data and it will all be swapped in and out of the card. It will be slow as hell but it will work.

If you need some performance, split it up + use mip-maps.
OK, I am new so will have to look through some other areas to learn exactly how to do that. My limited knowledge of this is something like this.

- Load Large Image Map from file into a surface
- copy 256x256 sections from the surface to many textures
- dispose large surface to free up memory

- or load 256x256 sections from image file right to textures

- use mip mapping for speed when zoomed out
- figure out which sections need to be displayed
- make vertex quads and fill with them with the right textures
- fit quads together in back buffer
- flip to display

- experiment with different texture sizes since 256x256 is the max for some cards.

This topic is closed to new replies.

Advertisement