Sprites...

Started by
5 comments, last by Becks7 20 years, 5 months ago
The sprites are displayed in different size than their original one .. How can i display my sprites in their real size ?
Advertisement
Either make the texture that is loaded a power of 2 (1x1,2x2,4x4,16x16,32x32,64x64,128x128,256x256,512x512,1024x1024 etc).
Or load your texture using no filter (D3DX_FILTER_NONE IIRC, see DXSDK docs).
BTW: If you''re using D3DXCreateTextureFromFile, use D3DXCreateTextureFromFileEx, so you can set the filter.

Personally, I''d go for the texture, faster & easier, and you don''t have to change the code.

--
You''re Welcome,
Rick Wong
- sitting in his chair doing the most time-consuming thing..
Hi!
Thank you very much!
I have changed the size of my texture , but now i have a new problem - this is not good for the collisions because now the image has a bigger size.
But maybe i will try to solve the problem with the filter.
I have a somewhat related question. Does your texture have to be the same width by height. Because I have a 512x256 texture, and it seems to work fine, but I want to know ahead of time.
Nope, just same multiples
It actually depends on your Graphics card. Some support (probably the newer ones) it some don''t.

--
You''re Welcome,
Rick Wong
- sitting in his chair doing the most time-consuming thing..
Some one on here told me I was wrong when I mentioned this "wrong size thing", as well, shows how much he knew. Sorry about that I was working really hard on this and the guy just basicly told me I was stupid or something. any way...
Using LoadtexturefromEx, is probably right (the best) way but another way is for your scaling, look at the size of your picture and then divide it by the next power of 2 up wards for both the height and width, that will give you the right scaling. So if your bitmap is 100 pixels high divide 100 by 128 and usr that result, which would be 0.781 as your scaling, so put 0.781f as the y scale do the same for width as well ie the next power of two higher than your bitmaps width.

This topic is closed to new replies.

Advertisement