I'm using MDX+VB and am trying to build the background map of a simple overhead game. I'm using tiles, though the map doesn't scroll, so I can make custom maps out of ascii files. I'm using the Sprite class and the Draw2D function.
I am completely clueless on how to copy two bitmaps (just two tiles for now) into one texture. The methods I see for creating textures don't seem to have destination rectangles, so I could get one bitmap loaded, but what about the second one
I also don't want to be building these textures on the fly since the map is static. At game start I just want to write bitmaps A and B to Texture and then leave those files alone.
Any help would be greatly appreciated!!

Build background out of multiple bitmaps
ginganinja
The Point Filter is a good choice if you want a pixel to pixel copy. The pool depends on what you want to do with your texture. For textures the managed pool is often the right choice.
Your green artifacts can have multiple reasons. You say your tiles are 32*32 but you load it to a 65*32 surface. If your bitmap contains two tiles it should be 64*32.
Rohit Tela
sepehr.Beigi
You can load every of your bitmaps to an own surface (SurfaceLoader.FromFile). After this step you need to create a texture that is large enough by your own. Now get the highest level mipmap surface (Texture.GetSurfaceLevel). At last copy your bitmap surfaces to the right position in your texture surfaces with one of the Surface.FormSurface methods.
Shlomi Meoded
Thanks Ralf. I used 65x32 because I put a border line between the two tiles. I will try changing the texture pool later tonight.
Still stumped on the artifacts. If I write tiles where they're located, then it goes away. But that leads to another problem, I can't seem to clear my background Sprite from one run of the full .exe to the next.
So if I write a tile to 50,50 one time, then rerun the program with the tile at 0,0, I see it in both places!
I'm so confused because I have a class terminate event, I confirmed it is running, and I run .Dispose on every Direct3D object I have. Is the order of disposed objects important, or do I need to set them to Nothing before or afterwards
Thanks!
Rich_Cov
Awesome Ralf! You got me pointed in the right direction. Now just two small questions.
I created a background texture of 1024x512, then successfully wrote two 32*32 tiles to the upper left. But I had a bunch of green artifacts in the middle of the map. Sort of looks like text from the matrix movie. Any idea why that happens Closely related to that, could you review my surface code to see if it looks ok Formats and pools and filters really have me confused!
Private
surfBack As Surface 'surface in memory to hold entire map Private surfTiles As Surface 'surface to load individual tiles toBackground =
New Direct3D.Sprite(D3Ddev) BackgroundTexture = New Texture(D3Ddev, 1024, 512, 0, Usage.None, Format.R5G6B5, Pool.Default)surfBack = BackgroundTexture.GetSurfaceLevel(0) 'get background texture surface
'open tile surface for loading two 32*32 test tilessurfTiles = D3Ddev.CreateOffscreenPlainSurface(65, 32, Format.R5G6B5, Pool.Default)
SurfaceLoader.FromFile(surfTiles, "c:\TestSpr.bmp", Filter.Point, 255)
'copy tiles to backgroundSurfaceLoader.FromSurface(surfBack,
New Rectangle(0, 0, 65, 32), surfTiles, New Rectangle(0, 0, 65, 32), Filter.Point, 255)