Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

wessel

textured quad distorted

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

I''ve been lurking around this forum for a few months but I can''t find the answer to my latest problem. So far I''ve been making all my textures with dimensions in powers of two, and everything has worked great. However, I went to program a splash screen intro for my game, and the image is getting distorted (looks a little squished). The dimensions of the splash screen image are 640x480. When I use square images, there is no distortion. My vertices look like this: CustomVertex.TransformedTextured[] vertices = (CustomVertex.TransformedTextured[])vb.Lock(0, LockFlags.None);
			vertices[0] = new CustomVertex.TransformedTextured(this.AbsoluteLocation.X, this.AbsoluteLocation.Y, 0.0f, 1.0f, 0.0f, 0.0f);
			vertices[1] = new CustomVertex.TransformedTextured(this.AbsoluteLocation.X + this.Bounds.Width, this.AbsoluteLocation.Y, 0.0f, 1.0f, 1.0f, 0.0f);
			vertices[2] = new CustomVertex.TransformedTextured(this.AbsoluteLocation.X, this.AbsoluteLocation.Y + this.Bounds.Height, 0.0f, 1.0f, 0.0f, 1.0f);
			vertices[3] = new CustomVertex.TransformedTextured(this.AbsoluteLocation.X + this.Bounds.Width, this.AbsoluteLocation.Y + this.Bounds.Height, 0.0f, 1.0f, 1.0f, 1.0f);
			
			vb.Unlock();
						
			this.D3DDevice.SetTexture(0, this.Texture);
			
			this.D3DDevice.SetStreamSource(0, vb, 0);
			this.D3DDevice.VertexFormat = CustomVertex.TransformedTextured.Format;
			this.D3DDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
 

Share this post


Link to post
Share on other sites
Advertisement
I had problems with distortion unless I loaded my texture in without filtering. The default filtering seems to distort static images.

You could also just use the sprite interface. I have found the performance to be no better/worse than the textured quads for a splash/title screen.

Share this post


Link to post
Share on other sites
I ended up just making my splash screen 512x512 but I did look into the sprites and they would have worked so thanks. Another idea I thought of is making a larger texture than needed and adjusting the tu/tv to get what I need out of it. Seems obvious now but we all know how inspiration works.

Share this post


Link to post
Share on other sites

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