Exemple #1
0
 public PixelFormatDescriptor(
     System.Drawing.Imaging.PixelFormat drawingFormat,
     PixelInternalFormat glInternalPixelFormat,
     PixelFormat glPixelFormat,
     PixelType glPixelType)
 {
     DrawingFormat         = drawingFormat;
     GLPixelInternalFormat = glInternalPixelFormat;
     GLPixelFormat         = glPixelFormat;
     GLPixelType           = glPixelType;
 }
Exemple #2
0
 public PixelFormatDescriptor(
     System.Drawing.Imaging.PixelFormat drawingFormat,
     PixelInternalFormat glInternalPixelFormat,
     PixelFormat glPixelFormat,
     PixelType glPixelType)
 {
     DrawingFormat = drawingFormat;
     GLPixelInternalFormat = glInternalPixelFormat;
     GLPixelFormat = glPixelFormat;
     GLPixelType = glPixelType;
 }
Exemple #3
0
        private static void GetOpenGlFormat(System.Drawing.Imaging.PixelFormat drawingFormat,
                                            out PixelInternalFormat glInternalPixelFormat, out PixelFormat glPixelFormat, out PixelType glPixelType)
        {
            switch (drawingFormat)
            {
            case System.Drawing.Imaging.PixelFormat.Format8bppIndexed:     // misses glColorTable setup
                glInternalPixelFormat = PixelInternalFormat.R8;
                glPixelFormat         = PixelFormat.Red;
                glPixelType           = PixelType.UnsignedByte;
                break;

            case System.Drawing.Imaging.PixelFormat.Format16bppArgb1555:
            case System.Drawing.Imaging.PixelFormat.Format16bppRgb555:     // does not work
                glInternalPixelFormat = PixelInternalFormat.Rgb5A1;
                glPixelFormat         = PixelFormat.Bgr;
                glPixelType           = PixelType.UnsignedShort5551Ext;
                break;

            case System.Drawing.Imaging.PixelFormat.Format24bppRgb:     // works
                glInternalPixelFormat = PixelInternalFormat.Rgb8;
                glPixelFormat         = PixelFormat.Bgr;
                glPixelType           = PixelType.UnsignedByte;
                break;

            case System.Drawing.Imaging.PixelFormat.Format32bppRgb:     // has alpha too? wtf?
            case System.Drawing.Imaging.PixelFormat.Canonical:
            case System.Drawing.Imaging.PixelFormat.Format32bppArgb:    // works
                glInternalPixelFormat = PixelInternalFormat.Rgba;
                glPixelFormat         = PixelFormat.Bgra;
                glPixelType           = PixelType.UnsignedByte;
                break;

            default:
                throw new NotSupportedException(drawingFormat.ToString());
            }
        }