0
\$\begingroup\$

I'm not an expert in creating game engines, but I'm doing fine for now. Recently I reached a point that I couldn't solve any of my problems. I have two questions:

  1. I'm using D3DXMatrixTransformation2D to produce the transformation matrix for my sprites, but I have a problem with rotation. Whenever I try to set a rotation for my sprite, it does turn when there is a fixed value of rotation. If I give 0.5f it won't rotate, but when I set 1, 2, 3, ... it'll work and that's not really cool. And, I searched a lot about pScalingRotation but it seems it's hasn't any influence. My rotation's value is fine, but the produced matrix doesn't act the way I expect it to.

  2. I want to get a smooth edge for my sprites when they're rotating and I saw p_device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);. Where should I set the sampler state? After creating the device or after every update? And, what about texture filters? I use D3DXCreateTextureFromFileEx to load textures from file and it has Filter and MipFilter. Are these related to the sampler state?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$
  1. What is the produced rotation matrix when you insert a value like 0.5f? And how doesn't it work, do you mean that 1.5f would produces the same visual result as 1.0f? What happens when you construct a rotation matrix manually? (See here how to construct them)

  2. The MAGFILTER (magnification) is the filter used when pixel density in the source texture is lower than the pixel density on screen of the textured object (when the opposite is true the MINFILTER (minification) is used). It will not change the smoothness of the borders of a sprite when its rotated, for that you need to use an anti-aliasing technique.

\$\endgroup\$
3
  • \$\begingroup\$ Like you said, 1.5f would have the same result as 1.0f. I haven't checked manual rotation matrix yet, but I'll do. By the way, I'm using D3DXSprite for drawing, does multi-sampling work on sprites too? Because I set the properties for it and didn't get any result. \$\endgroup\$
    – MahanGM
    Apr 6, 2013 at 23:08
  • \$\begingroup\$ I fixed my rotation issue but still having problem with anti-aliasing. \$\endgroup\$
    – MahanGM
    Apr 7, 2013 at 15:50
  • \$\begingroup\$ Hey! I fixed my smoothness too. I was using wrong surface format. Thanks for the help. \$\endgroup\$
    – MahanGM
    Apr 7, 2013 at 16:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .