diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs
index 8d0f4b75..4856a4d9 100644
--- a/Vocaluxe/Lib/Draw/CDirect3D.cs
+++ b/Vocaluxe/Lib/Draw/CDirect3D.cs
@@ -430,6 +430,12 @@ namespace Vocaluxe.Lib.Draw
/// If true, then color is faded out in y direction
private void _DrawTexture(CD3DTexture texture, SDrawCoords dc, SColorF color, bool isReflection = false)
{
+ //Align the pixels because Direct3D expects the pixels to be the left top corner
+ dc.Wx1 -= 0.5f;
+ dc.Wy1 -= 0.5f;
+ dc.Wx2 -= 0.5f;
+ dc.Wy2 -= 0.5f;
+
color.A *= CGraphics.GlobalAlpha;
int c = color.AsColor().ToArgb();
int c2;
@@ -446,7 +452,7 @@ namespace Vocaluxe.Lib.Draw
vert[1] = new STexturedColoredVertex(new Vector3(dc.Wx1, -dc.Wy2, dc.Wz), new Vector2(dc.Tx1, dc.Ty2), c2);
vert[2] = new STexturedColoredVertex(new Vector3(dc.Wx2, -dc.Wy2, dc.Wz), new Vector2(dc.Tx2, dc.Ty2), c2);
vert[3] = new STexturedColoredVertex(new Vector3(dc.Wx2, -dc.Wy1, dc.Wz), new Vector2(dc.Tx2, dc.Ty1), c);
- _DrawTexture(vert, texture.D3DTexture, _CalculateRotationMatrix(dc.Rotation, dc.Wx1, dc.Wx2, dc.Wy1, dc.Wy2));
+ _AddToVertexBuffer(vert, texture.D3DTexture, _CalculateRotationMatrix(dc.Rotation, dc.Wx1, dc.Wx2, dc.Wy1, dc.Wy2));
}
///
@@ -455,7 +461,7 @@ namespace Vocaluxe.Lib.Draw
/// A TexturedColoredVertex array containg 4 vertices
/// The texture the vertex should be textured with
/// The vertices' rotation
- private void _DrawTexture(STexturedColoredVertex[] vertices, Texture tex, Matrix rotation)
+ private void _AddToVertexBuffer(STexturedColoredVertex[] vertices, Texture tex, Matrix rotation)
{
//The vertexbuffer is full, so we need to flush it before we can continue
if (_Vertices.Count >= CSettings.VertexBufferElements)
diff --git a/Vocaluxe/Lib/Draw/CDrawBase.cs b/Vocaluxe/Lib/Draw/CDrawBase.cs
index 19017a5f..c5688320 100644
--- a/Vocaluxe/Lib/Draw/CDrawBase.cs
+++ b/Vocaluxe/Lib/Draw/CDrawBase.cs
@@ -260,13 +260,6 @@ namespace Vocaluxe.Lib.Draw
drawCoords.Ty2 = Math.Min(1, (bounds.Bottom - rect.Y) / rect.H) * texture.HeightRatio;
drawCoords.Wy2 = Math.Min(rect.Bottom, bounds.Bottom);
- //TODO: Check this:
- /*//Align the pixels because Direct3D expects the pixels to be the left top corner
- rx1 -= 0.5f;
- ry1 -= 0.5f;
- rx2 -= 0.5f;
- ry2 -= 0.5f;*/
-
if (mirrored)
{
float tmp = drawCoords.Ty1;
diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs
index 91cd3e31..6617466c 100644
--- a/Vocaluxe/Lib/Draw/COpenGL.cs
+++ b/Vocaluxe/Lib/Draw/COpenGL.cs
@@ -440,6 +440,12 @@ namespace Vocaluxe.Lib.Draw
#region drawing
private static void _DrawTexture(COGLTexture texture, SDrawCoords dc, SColorF color, bool isReflection = false)
{
+ // Align textures to full pixels to reduce artefacts
+ dc.Wx1 = (float)Math.Round(dc.Wx1);
+ dc.Wy1 = (float)Math.Round(dc.Wy1);
+ dc.Wx2 = (float)Math.Round(dc.Wx2);
+ dc.Wy2 = (float)Math.Round(dc.Wy2);
+
GL.BindTexture(TextureTarget.Texture2D, texture.Name);
GL.Enable(EnableCap.Blend);