Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am working on a project, where I am trying to build a (large) 2D map with Icons on it.

 

This works ok, untill I try to load map file (a 2500x2500 file), then my Texture.FromBitmap function crashes with the error message:

-2005530516 (D3DERR_INVALIDCALL)

in line:

m_TextureHash[ imageName ] = Texture.FromBitmap( m_Device, theImage, 0, Pool.Default );

 

It works if I insted do this:

TextureLoader.FromFile( m_Device, path );

 

But I want to manipulate the Image object, before I load the texture. How can I do this ?

 

Thx in advance,

-maZZoo

  • Leaders
Posted

Have you tried explicitly loading textures into the managed pool? I don't know if that is the problem, but I have seen similar issues.

 

[Vb]

m_TextureHash[ imageName ] = Texture.FromBitmap( m_Device, theImage, 0, Pool.Managed);

[/code]

[sIGPIC]e[/sIGPIC]
Posted

Thx for the idea unfortunally I have tryed that, and it does not seem to work,

maybe its because of the large memory consumsion it requires ?

 

I've gotton this to work (sort of)

 

m_TextureHash[ imageName ] = TextureLoader.FromFile( m_Device, imageName );

 

Only problem is, that it converts the image to a by 2 number ( eg 2048x2048 insted of the original 2500x2500 )

 

So I cannot use that,

Hope that somebody out there have a answer !

 

-maZZoo

  • 4 weeks later...
Posted (edited)

Hi Mazzoo,

I'm working on what sounds like a similar project. I have large 2D images (10000x10000) onto which I want to draw additional stationary items and also some moving items. The user can then scroll around this composite image. I ran into similar problems with Textures as powers of 2 and size limitations imposed by my Graphics Card (2048x2048 max).

 

I did think of using DirectDraw but the MSDN warnings plus having to convert my jpg to a bmp to load it made me shy away and plunge into Direct3D.

 

Ken Paulson over at http://www.drunkenhyena.com/ supplied me with the scheme for a solution. (Ken's site is being revamped and I think the DirectX Tutorials are still offline). However, it goes like this:

 

(I have large images now being displayed in a picturebox with the user scrolling them.)

Create a Texture (same size as your picturebox say)

boximage=Textureloader.fromfile(Device,TextureFile)

Create a surface to hold your Map image

backbuffer=graphicsdevice.CreateOffscreenPlainSurface(............

Load your map Image onto this surface

surfaceloader.FromFile(backbuffer,..................

Get a surface from your Texture

imgsurface=boximage.getsurfacelevel(0)

Load this surface with the "visible" part of your Map Image Surface

surfaceloader.FromSurface(imgsurface,backbuffer,.........

Then I use Sprite.Draw2D in my Render routine.

 

This works really well. Now where I'm stuck is in being able to draw lines & rounded boxes on my Map Image surface (ie Backbuffer).

 

Hope this helps.

Edited by nagajim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...