Jump to content
  • Advertisement
Sign in to follow this  

Scaling limitation ?

This topic is 3346 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

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
Sign in to follow this  

  • 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!