Sign in to follow this  
2mas

Problem Mapping pixels to texels (DirectX)

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

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