Bonjour, je charge un PNG de 48x48 pixels de la façon suivante:
Je l'affiche ensuite sur un quad de la façon suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 ImageInformation l_imageInformation = new ImageInformation(); Texture = TextureLoader.FromFile(m_device, location, 0, 0, 0, Usage.None, Microsoft.DirectX.Direct3D.Format.A8R8G8B8, Pool.Managed, Filter.None, Filter.None, 0, ref l_imageInformation);
Si je dessine un rectangle,
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 m_textureVertices[0].X = 0; m_textureVertices[0].Y = 0; m_textureVertices[0].Tu = 0; m_textureVertices[0].Tv = 0; m_textureVertices[1].X = 100; m_textureVertices[1].Y = 0; m_textureVertices[1].Tu = 1.0; m_textureVertices[1].Tv = 0; m_textureVertices[2].X = 0; m_textureVertices[2].Y = 100; m_textureVertices[2].Tu = 0; m_textureVertices[2].Tv = 1.0; m_textureVertices[3].X = 100; m_textureVertices[3].Y = 100; m_textureVertices[3].Tu = 1.0; m_textureVertices[3].Tv = 1.0; m_device.SetTexture(0, Texture); m_device.VertexFormat = CustomVertex.TransformedTextured.Format; m_device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, m_textureVertices); m_device.SetTexture(0, null);
Et je ne comprends pas pourquoi la texture n'occupe pas la totalité du rectangle 100x100, alors qu'elle est censé le faire.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 m_rectangleVertices[0].X = 0; m_rectangleVertices[0].Y = 0; m_rectangleVertices[0].Color = Color.Blue.ToArgb(); m_rectangleVertices[1].X = 100; m_rectangleVertices[1].Y = 0; m_rectangleVertices[1].Color = Color.Blue.ToArgb(); m_rectangleVertices[2].X = 100; m_rectangleVertices[2].Y = 100; m_rectangleVertices[2].Color = Color.Blue.ToArgb(); m_rectangleVertices[3].X = 0; m_rectangleVertices[3].Y = 100; m_rectangleVertices[3].Color = Color.Blue.ToArgb(); m_rectangleVertices[4].X = 0; m_rectangleVertices[4].Y = 0; m_rectangleVertices[4].Color = Color.Blue.ToArgb(); m_device.VertexFormat = CustomVertex.TransformedColored.Format; m_device.DrawUserPrimitives(PrimitiveType.LineStrip, 4, m_rectangleVertices);
Le comble, c'est que quand je charge la texture de la façon suivante (avec l'option Filter.Linear plutot que Filter.None):
ca marche correctement !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 ImageInformation l_imageInformation = new ImageInformation(); Texture = TextureLoader.FromFile(m_device, location, 0, 0, 0, Usage.None, Microsoft.DirectX.Direct3D.Format.A8R8G8B8, Pool.Managed, Filter.Linear, Filter.None, 0, ref l_imageInformation);
Idem, ca marche bien aussi si j'utilise Sprite.Draw2D(...), sans l'option Linear.
Ca marche bien aussi si je charge un .bmp sans l'option Linear.
une idée ?
D'avance merci
Partager