a couple of questions

apanjocko

Newcomer
Joined
Aug 27, 2003
Messages
13
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
 
Last edited:
Has it got the .Net framework? And you may need to copy Microsoft.DirectX*.dll into the program directory on the other computer to.
 
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 :)
 
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.
 
i'm now creating the texture with Texture.FromBitmap so i can analyse the contents in the Bitmap itself before creating the texture. this eliminates question 1 and 2! :)
 
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
 
Back
Top