For example, if you use the simple example code to create a HUD logo, it uses a 100w 45h texture. Because the width has an even number of pixels, and the (0,0) position of this texture is the middle, it falls between two pixels horizontally, causing all vertical lines to be blurred across two pixels.
here is a screenshot for example:
Here is the code used to render the fragment.
- Code: Select all
BrumeSquareTextured logo = new BrumeSquareTextured(this, "Brume logo");
BrumeTexture texture = new BrumeTexture(this, "logo test",100, 45, 1, BrumeTextureParams.FORMAT_X8R8G8B8);
Graphics gc = texture.GetGraphics();
gc.DrawString("GDI Test", new Font(FontFamily.GenericSansSerif, 10.0f), Brushes.White, 0, 0);
gc.DrawLine(new Pen(Color.White), 0, 45 / 2, 100, 45 / 2);
gc.DrawLine(new Pen(Color.White), 100 - 4, 0, 100 - 4, 45);
texture.ReleaseGraphics();
logo.RenderStates.Lighted = false;
logo.RenderStates.Texture[0] = texture;
logo.RenderStates.Perspective = BrumeRenderParams.PERSPECTIVE_HUD;
logo.RenderStates.AlphaBlending = BrumeRenderParams.ALPHABLENDING_TEXTUREALPHA;
logo.HasGlobalSize = false;
logo.XSize = 100.0f;
logo.YSize = 45.0f;
logo.Pos.X = HUDX(this.BrumeWidth - 60);
logo.Pos.Y = HUDY(this.BrumeHeight - 40);
Are there any recommendations on how to handle HUD items so this does not occur?
Right now I'm going to make a BrumeSquareHudTextureMesh which has (0,0) as the upper-left coordinate of the mesh, instead of putting (0,0) in the center of the square. Is this the approach others use?