究竟是什么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来公开数据的内部表示? –