究竟是什麼System.Drawing.Imaging.PixelFormat.Alpha代表誰?看起來這與OpenGL.GL_APHA類似,這是折舊的。C#圖像像素格式只
我想行的Java代碼看起來像這樣的轉換:
TextureData textureData = new TextureData(GL.GL_ALPHA, size, size, 0, GL.GL_ALPHA,
GL.GL_UNSIGNED_BYTE, false, false, false, textureBytes.rewind(), null);
其C#represenation。
我已經定義了一個類來封裝象素格式,讓我來回走DirectX和OpenGL之間如下:
public class PixelFormat
{
public static readonly PixelFormat R8 = new PixelFormat(8, 0, DataType.UnsignedByte);
public static readonly PixelFormat R5G5B5A1 = new PixelFormat(5, 1, DataType.UnsignedShort);
public bool IsColorPremultipliedByAlpha { get; private set; }
public bool IsCompressed { get; private set; }
public int Format { get; set; }
public double Gamma { get; private set; }
public int BitsPerPixel { get { return NumberOfRedBits + NumberOfGreenBits + NumberOfBlueBits; }}
public ushort NumberOfRedBits { get; private set; }
public ushort NumberOfGreenBits { get; private set; }
public ushort NumberOfBlueBits { get; private set; }
public ushort NumberOfAlphaBits { get; private set; }
public int IndexIntoColorPallete { get; set; }
public bool IsIndexed { get; set; }
public DataType DataType { get; set; }
public IndexedColorFormat IndexedColorFormat { get; set; }
public OpenglPixelAttributes GetOpenglConstant()
{
return null;
}
}
我會想代表System.Drawing.Imaging.PixelFormat.Alpha或其OpenGL的表親使用我的PixelFormat類的一個實例。
任何想法?
感謝您的精心迴應。問題是這個JAVA SDK,http://worldwind.arc.nasa.gov/java/,我移植目前不使用着色器。另外,你如何建議我構造PixelFormat來公開數據的內部表示? –