Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Sep 2010
Offline Last Active Mar 20 2012 07:11 PM

Posts I've Made

In Topic: D3DXSPRITE problem - wrongly scaled?

20 March 2012 - 07:12 PM

Ok, got it, thanks again! Yeah, was really wondering which part made it resize it... that it was the filter wasn't that intuitive for me.... thanks!

In Topic: D3DXSPRITE problem - wrongly scaled?

19 March 2012 - 08:04 PM

Ok, finally I understand, thanks again Steve!

It seems that D3DXCreateTextureFromFileEx not only loads the texture and fits it into an area the size of the next higher power of two (in my case my 424x69 texture would be 512x128), but it actually stretches it too. My original expectation was that it puts the 424x69 image into the 512x128 texture, and the excess area would just be either zeroed out or random uninitialized values, and when I draw my sprite and pass in the image size 424x69 it would just copy that section of the original image to the screen. But seeing that it stretches the texture to fill the 512x128 texture, then it also makes sense that it cuts it off. So the D3DX_DEFAULT_NONPOW2 setting actually fixed this.

Is that what it means in the MSDN documentation by "Mipmapped textures automatically have each level filled with the loaded texture. " ? Even though I only specified one level...

Sorry if this thread seems kinda silly and newbie-ish... but I am a newbie in this ;-) Anyway, it works now, so I can move on :-)


In Topic: D3DXSPRITE problem - wrongly scaled?

19 March 2012 - 10:03 AM

Here is the above mentioned screenshot, now with the source rectangle set to the size of the original image file, it just clips the parts that have been scaled up

In Topic: D3DXSPRITE problem - wrongly scaled?

19 March 2012 - 09:59 AM

Hi Steve,
thanks for your reply. I was loading already with

D3DXCreateTextureFromFileEx, but I didn't set the

D3DX_DEFAULT_NONPOW2 flag. However I just changed my code for testing, and am checking for the size of the texture (which as you said is rounded to the next power of 2), and I am storing the size of the original image in the file - for example the buttons are 29x29 and therefore end up 32x32, which makes sense). So when I am rendering it now, I am using that rectangle (ie 0,0,29,29) as the source rectangle, however I still got the scaling problem.

The difference compared to before is that now the textures fill the size of the screen as expected, but because they are still scaled they are now also cut off. Please see the screenshot.

So somewhere there must still be some scaling happening. But I don't know where, because I am not setting any view matrices or anything.

Hmm, I guess I must still be doing something stupid somewhere...

In Topic: D3DXSPRITE problem - wrongly scaled?

17 March 2012 - 04:37 AM

Anyone got an idea? I still can't make sense of it... :-/