Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Maega

Direct3D Sprite drawing

This topic is 5664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
aldca, f***ing again? what''s wrong with you?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Aface, f***ing again? what''s wrong with you?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
He probably just tries to be cool or something...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!