Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

thank you for reading this.

 

i'm currently using direct3d for 2d graphics and are having different kinds of small problems.

 

1.

i am loading graphics for my sprites using the Direct3D.TextureLoader.FromFile method, and gathering information from the file, like width and height, using the Direct3D.TextureLoader.ImageInformationFromFile. i assume there must be a better way to do this than to read the file physically twice. i can't find the information in the texture.

 

2.

i would like to get a hold of the pixel data inside the texture to be able to [1] scan the picture to find its _actual_ size rather than the 2^x texture size and [2] do pixel perfect collision detection. where is the data hidden?

 

3.

the little game runs fine on my computer (directx9.0b) but does not run at all at my friends computer (directx9.0a). it doesn't even enter the main method as all exceptions are catched and none are apparently thrown. just a standard windows error of some sort. anyone knows what this is related to? a/b? EDIT: he has no developping libraries as i do.

 

thank you plenty

apanjocko

Edited by apanjocko
Posted
Has it got the .Net framework? And you may need to copy Microsoft.DirectX*.dll into the program directory on the other computer to.
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

yes, he has the 1.1 .net framwork.

are you sure about the .dll's? where can i find these? it seems ridiculus that you have to ship all the unmanaged directx dll's with the game. where can you read about that?

 

thanks :)

Posted

ok

he has now downloaded the 9.0b runtime and it still doesn't work. it's obvious that he LACKS the managed direct 9 dll's. i found those in the directx 9 dev-runtime download from microsoft's site but as he is not a developper where does he find a download for that? thanks.

  • *Experts*
Posted

For step 1 and 2, you can also use the GetLevelDescription method to return a SurfaceDescription structure full of detailed info about the bitmap you loaded. Keep in mind that the built in texture loading methods will stretch your bitmap to meet the power of 2 requirements. Meaning, if you have a 120x96 texture, you might end up with a 128x128 or 256x256 bitmap with all of your original bitmap data stretched out. At least, that's what I've seen (and read that that's pretty much how it works).

 

To read the pixel data, I use LockRectangle, a method of the Surface object. You can get a surface from a texture using the Texture's GetSurfaceLevel method. LockRectangle is its own little beast. See if you can find some help on Google. If not, I can dig up some old code that uses it :)

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

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...