Sign in to follow this  
Boemer

Scaling limitation ?

Recommended Posts

Hi, I'm using C# + SlimDX, and I was playing with the Matrix.Tranformation2D. I'm trying to use a Sprite.Transform to create a zoomIn or zoomOut effect.
private float m_rotation = 0;
private float m_scaling = 1;
private float m_factor = 0.01f;
Vector2 center = new Vector2(picture.Left + picture.Width / 2, picture.Top + picture.Height / 2);

m_sprite.Transform = SlimDX.Matrix.Transformation2D(
	center, 0, 
	new Vector2(m_scaling,m_scaling),
	center, m_rotation, Vector2.Zero);

m_rotation += 0.1f;
m_scaling += m_factor;
if (m_scaling > 2)
  m_factor = -0.01f;
if (m_scaling < 0.1f)
  m_factor = +0.01f;
The above piece is called 60x a second, it makes a sprite rotate and shrink and grow the whole time. What I noticed, which is a my problem. If I only scale X or Y it works fine, you can scale below 0.1f, and it is still visible. If you scale both X and Y down, the sprite, becomes transparent and disappears. Am I doing something wrong? The Sprite is still relatively big, when this strange behaviour starts.

Share this post


Link to post
Share on other sites
I was think about mipmap, not wanting it, but maybe directx is thinking about it..

I create the texture like the following:

m_texture = new Texture(m_device, width, height, 0, 0, Format.A8R8G8B8, Pool.Managed);


first 0, I think would mean I don't want mipmap, I just want 1 texture...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this