コード例 #1
0
        public void updateData()
        {
            int         w    = myTexture.width;
            int         h    = myTexture.height;
            int         comp = 3;
            PixelFormat pf   = PixelFormat.Rgb;

            switch (myTexture.pixelFormat)
            {
            case PixelInternalFormat.R32f: comp = 1; pf = PixelFormat.Red; break;

            case PixelInternalFormat.Rgb: comp = 3; pf = PixelFormat.Rgb; break;

            case PixelInternalFormat.Rgb32f: comp = 3; pf = PixelFormat.Rgb; break;

            case PixelInternalFormat.Rgba: comp = 4; pf = PixelFormat.Rgba; break;

            case PixelInternalFormat.Rgba32f: comp = 4; pf = PixelFormat.Rgba; break;
            }

            myData = new float[w * h * comp];

            myTexture.bind();
            GL.GetTexImage(myTexture.target, 0, pf, PixelType.Float, myData);
            myTexture.unbind();
        }