Jump to content
  • Advertisement
Sign in to follow this  
nixon

Managed Direct3D - Scaling down a Texture

This topic is 4223 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 using the SampleFramework (used in the DirectX SDK's samples) and I've managed to display a 1600x1200 background MainMenu image by using a Texture and a Sprite. Im having some mayor problems in finding a way to size this texture down so it f.ex. fits in my default 800x600 start window. OnCreateDevice() { myTexture = TextureLoader.FromFile(e.Device, Utility.FindMediaFile("mainmenu02.jpg"), 1600, 1200, 0, Usage.None, Format.A8R8G8B8, Pool.Managed, Filter.None, Filter.None, (int)(0xFF000000)); mySprite = new TextureSprite(cardTexture, new System.Drawing.Rectangle(0, 0, 800, 600)); } OnFrameRender() { mySprite.Draw(batchSprite); } Any ideas? Thank you.

Share this post


Link to post
Share on other sites
Advertisement
I don't have any experience with sprites but all you need to do is adjust the four vertices that make up the corners. Simply adjusting the three right-bottom vertices positions to be 800,600 would do it. If you then leave the uv data alone the hardeware will auto size the texture it displays into this new region.

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!