0
Dieser Code erstellt eine Textur mit einem Alpha-Kanal ungleich Null.XNA. Textur2D. SetData. Wrong Alpha Chanel
Texture2D result = new Texture2D(Program.MainThread.GraphicsDevice, (Int32)texture_size, (Int32)texture_size);
Color[ ] colorData = new Color[result.Width * result.Height];
for (UInt32 x = 0; x < result.Width; x++) {
for (UInt32 y = 0; y < result.Height; y++) {
UInt32 index = (UInt32)(x * result.Width + y);
colorData[index] = new Color(1f, 0f, 0f, 0f);
}
}
result.SetData(colorData);
Die Farbe wird leicht transparent. Aber, ungefähr, zum Wert von 0.5f. Warum passiert dies?
P.S. Color.Transparent richtig funktioniert, aber ich habe einen Alpha-Kanal programmatisch berechnet werden, zum Beispiel:
colorData[index] = new Color(1f, 0f, 0f, 1f - temp);