Direct3D Sprite drawing

Started by
7 comments, last by Maega 21 years, 2 months ago
Hello, Im drawing a sprite (a 640x480 jpg) and it keeps getting stretched. Is there a way to stop it? I tried setting scaling to 0,0 but that didn't work edit: Forgot to mention that the Im using LoadTextureFromFile (dunno if thats the right one) [edited by - Maega on February 9, 2003 4:27:01 PM]
Advertisement
I am guessing ur using the ID3DXSprite interface. You need to set the scaling to 1,1 for the original fucking size to print out. Also, you should either save your original image in a power of 2 size (eg 256x256 or 512x256 etc) because when the texture is created, it will scale to this size. The other way to solve the prob is to leave the pic as is, note the size, and then set the source coordinates of the image when blitting (the draw function) to be this size. The 2nd way requires a little more sophistication on the part of your fucking resourse system or whatever you use to handle resources.

aface
I will appreciate it next time you answer one of my questions if you do not use the language .

Other than that, I''ll give it a shot and see.

Thank you
quote:Original post by Aface
I am guessing ur using the ID3DXSprite interface. You need to set the scaling to 1,1 for the original fucking size to print out. Also, you should either save your original image in a power of 2 size (eg 256x256 or 512x256 etc) because when the texture is created, it will scale to this size. The other way to solve the prob is to leave the pic as is, note the size, and then set the source coordinates of the image when blitting (the draw function) to be this size. The 2nd way requires a little more sophistication on the part of your fucking resourse system or whatever you use to handle resources.
aface


You need to chill man...

The stretching occurs when a filter is applied to the texture. By using D3DXCreateTextureFromFile, the default filter is applied, D3DX_FILTER_TRIANGLE | D3DXFILTER_BOX. If you use D3DXCreateTextureFromFileEx, you can specify the filter you want. If you don''t want any stretching, use D3DX_FILTER_NONE. This should fix the problem.

-----------------------------
kevin@mayday-anime.com
http://www.mayday-anime.com
-----------------------------kevin@mayday-anime.comhttp://www.mayday-anime.com
Grasshopa55 - the resizing actually happens to all textures. All the filter does is determine the stretching type - ie setting D3DX_FILTER_NONE means that the original image is used, but the texture is enlarged to the power-of-2 rule, and the extra texture added to make up the power-of-2 rule is set as transparent black. I just mention this because if you have a fucking resource system, and you are trying to stretch an image to fit a specific space, you will need to use the original source image size to stretch to (not the actual size including the transparent black)

Hope this helps.
a
aldca, f***ing again? what''s wrong with you?
Aface, f***ing again? what''s wrong with you?
He probably just tries to be cool or something...

This topic is closed to new replies.

Advertisement