コード例 #1
0
        Texture GetPatternTexture(OpenGlDevice Device)
        {
            Texture Save = Device.texture;

            if (Pattern == null)
            {
                return(null);
            }
            Rectangled R           = new Rectangled(Pattern.PatternX, Pattern.PatternY, Pattern.PatternWidth, Pattern.PatternHeight);
            FBO        FrameBuffer = new FBO();

            FrameBuffer.BackGround = System.Drawing.Color.Transparent;
            Device.PushMatrix();
            xyz   RU  = new xyz(R.Width, R.Height, 0);
            xyz   RD  = new xyz(R.X, R.Y, 0);
            Point _RU = Device.ToScr(RU);
            Point _RD = Device.ToScr(RD);

            FrameBuffer.Init((int)(_RU.X - _RD.X), (int)(_RD.Y - _RU.Y));
            FrameBuffer.EnableWriting();
            Pattern.Paint(Device);
            Device.PopMatrix();
            FrameBuffer.DisableWriting();
            Texture result = FrameBuffer.Texture;

            Device.texture     = Save;
            result.WorldWidth  = R.Width;
            result.WorldHeight = R.Height;
            result.Translation = new xy(R.X, R.Y);
            FrameBuffer.Dispose(true);
            return(result);
        }
コード例 #2
0
ファイル: OpenGlDevice.cs プロジェクト: unitycoder/Drawing3D
        /// <summary>
        /// plays the scene in Bitmap.
        /// </summary>
        /// <returns></returns>
        public Bitmap ScreenShot()
        {
            FBO     FrameBuffer = new FBO((int)ViewPort.Width, (int)ViewPort.Height);
            Texture Save        = texture;

            FrameBuffer.EnableWriting();
            Refresh();
            FrameBuffer.DisableWriting();
            texture = Save;
            Bitmap Result = FrameBuffer.ReadBitmap();

            FrameBuffer.Dispose();
            return(Result);
        }