Microsoft.Xna.Framework.Graphics.ESTexture2D.InitWithDataGL11 C# (CSharp) Метод

InitWithDataGL11() публичный Метод

public InitWithDataGL11 ( IntPtr data, SurfaceFormat pixelFormat, int width, int height, Size size, OpenTK.Graphics.ES11 filter ) : void
data System.IntPtr
pixelFormat SurfaceFormat
width int
height int
size System.Drawing.Size
filter OpenTK.Graphics.ES11
Результат void
        public void InitWithDataGL11(IntPtr data, SurfaceFormat pixelFormat, int width, int height, Size size, GL11.All filter)
        {
            openGLVersion = GLContextVersion.Gles1_1;
            GL11.GL.GenTextures(1, ref _name);
            GL11.GL.BindTexture(GL11.All.Texture2D, _name);
            GL11.GL.TexParameter(GL11.All.Texture2D, GL11.All.TextureMinFilter, (int)filter);
            GL11.GL.TexParameter(GL11.All.Texture2D, GL11.All.TextureMagFilter, (int)filter);
            GL11.GL.TexParameter(GL11.All.Texture2D, GL11.All.TextureWrapS, (int)GL11.All.ClampToEdge);
            GL11.GL.TexParameter(GL11.All.Texture2D, GL11.All.TextureWrapT, (int)GL11.All.ClampToEdge);

            int sz = 0;

            switch (pixelFormat)
            {
                case SurfaceFormat.Color /*kTexture2DPixelFormat_RGBA8888*/:
                case SurfaceFormat.Dxt1:
                case SurfaceFormat.Dxt3:
                    sz = 4;
                    GL11.GL.TexImage2D(GL11.All.Texture2D, 0, (int)GL11.All.Rgba, (int)width, (int)height, 0, GL11.All.Rgba, GL11.All.UnsignedByte, data);
                    break;
                case SurfaceFormat.Bgra4444 /*kTexture2DPixelFormat_RGBA4444*/:
                    sz = 2;
                    GL11.GL.TexImage2D(GL11.All.Texture2D, 0, (int)GL11.All.Rgba, (int)width, (int)height, 0, GL11.All.Rgba, GL11.All.UnsignedShort4444, data);
                    break;
                case SurfaceFormat.Bgra5551 /*kTexture2DPixelFormat_RGB5A1*/:
                    sz = 2;
                    GL11.GL.TexImage2D(GL11.All.Texture2D, 0, (int)GL11.All.Rgba, (int)width, (int)height, 0, GL11.All.Rgba, GL11.All.UnsignedShort5551, data);
                    break;
                case SurfaceFormat.Alpha8 /*kTexture2DPixelFormat_A8*/:
                    sz = 1;
                    GL11.GL.TexImage2D(GL11.All.Texture2D, 0, (int)GL11.All.Alpha, (int)width, (int)height, 0, GL11.All.Alpha, GL11.All.UnsignedByte, data);
                    break;
                default:
                    throw new NotSupportedException("Texture format");
            }

            _size = size;
            _width = width;
            _height = height;
            _format = pixelFormat;
            _maxS = size.Width / (float)width;
            _maxT = size.Height / (float)height;

            _pixelData = data;
        }