Esempio n. 1
0
        public static NUT_Texture fromPNG(string fname, int mipcount)
        {
            Bitmap      bmp = new Bitmap(fname);
            NUT_Texture tex = new NUT_Texture();

            tex.mipmaps.Add(fromPNG(bmp));
            for (int i = 1; i < mipcount; i++)
            {
                if (bmp.Width / (int)Math.Pow(2, i) < 4 || bmp.Height / (int)Math.Pow(2, i) < 4)
                {
                    break;
                }
                tex.mipmaps.Add(fromPNG(Pixel.ResizeImage(bmp, bmp.Width / (int)Math.Pow(2, i), bmp.Height / (int)Math.Pow(2, i))));
            }
            tex.Width  = bmp.Width;
            tex.Height = bmp.Height;
            tex.type   = PixelInternalFormat.Rgba;
            tex.utype  = OpenTK.Graphics.OpenGL.PixelFormat.Rgba;

            return(tex);
        }
Esempio n. 2
0
        public static BRTI.BRTI_Texture fromPNG(string filename, int mipcount)
        {
            Bitmap bmp = new Bitmap(filename);

            BRTI.BRTI_Texture tex = new BRTI.BRTI_Texture();

            tex.mipmaps.Add(fromPNG(bmp));
            for (int i = 0; i < mipcount; i++)
            {
                if (bmp.Width / (int)Math.Pow(2, i) < 4 || bmp.Height / (int)Math.Pow(2, i) < 4)
                {
                    break;
                }
                tex.mipmaps.Add(fromPNG(Pixel.ResizeImage(bmp, bmp.Width / (int)Math.Pow(2, i), bmp.Height / (int)Math.Pow(2, i))));
                tex.data = tex.mipmaps[0];
            }
            tex.width  = bmp.Width;
            tex.height = bmp.Height;
            tex.pixelInternalFormat = PixelInternalFormat.Rgba;
            tex.pixelFormat         = OpenTK.Graphics.OpenGL.PixelFormat.Rgba;

            return(tex);
        }