Jump to content
  • Advertisement
Sign in to follow this  
2mas

Problem Mapping pixels to texels (DirectX)

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

Hey, I have a little problem, when trying to display a background in my c# application. I have made the (0.5f) offsets, as described in the MSDN DirectX SDK, but it still will not render correct. When rendering the picture, it seems slightly blurry: Original: http://www.caseworld.dk/dx/Sharp.png Rendered: http://www.caseworld.dk/dx/Blurry.png The code http://www.caseworld.dk/dx/TestDXGUI.rar Please help me. If you need more information, I will find it for you. Sorry for my bad english.

Share this post


Link to post
Share on other sites
Advertisement
No offense, but I would much rather you just post the relevent code here then download and open up a RAR file. [smile]

Share this post


Link to post
Share on other sites
Ok, here you go:

private Vertex[] BuildVertexData()
{
int clr = Color.Transparent.ToArgb();

//float Pos = 800f / rect.Width * 0.5f;
float Pos = 0;

Vertex[] vertexData = new Vertex[4];
vertexData[0].PositionRhw = new Vector4(-Pos + rect.X + 0, Pos + rect.Y + 0, 0, 0);
vertexData[0].Color = clr;
vertexData[0].Tu = 0.0f;
vertexData[0].Tv = 0.0f;
vertexData[1].PositionRhw = new Vector4(-Pos + rect.X + rect.Width, Pos + rect.Y + 0, 0, 0);
vertexData[1].Color = clr;
vertexData[1].Tu = 1.0f;
vertexData[1].Tv = 0.0f;
vertexData[2].PositionRhw = new Vector4(-Pos + rect.X + rect.Width, Pos + rect.Y + rect.Height, 0, 0);
vertexData[2].Color = clr;
vertexData[2].Tu = 1.0f;
vertexData[2].Tv = 1.0f;
vertexData[3].PositionRhw = new Vector4(-Pos + rect.X + 0, Pos + rect.Y + rect.Height, 0, 0);
vertexData[3].Color = clr;
vertexData[3].Tu = 0.0f;
vertexData[3].Tv = 1.0f;

return vertexData;
}

[Edited by - 2mas on August 4, 2008 2:19:56 PM]

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!