CSharpGL.FBORenderContext.SetDimensions C# (CSharp) Method

SetDimensions() public method

public SetDimensions ( int width, int height ) : void
width int
height int
return void
        public override void SetDimensions(int width, int height)
        {
            //  Call the base.
            base.SetDimensions(width, height);

            //	Resize dib section.
            this.dibSection.Resize(width, height, this.BitDepth);

            //  TODO: We should be able to just use the code below - however we
            //  get invalid dimension issues at the moment, so recreate for now.
            ////  Resize the render buffer storage.
            //this.framebuffer.Resize(width, height);

            this.framebuffer.Dispose();
            Framebuffer framebuffer = CreateFramebuffer(width, height);
            this.framebuffer = framebuffer;
        }

Usage Example

Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);

            int width = this.Width, height = this.Height;

            if (width > 0 && height > 0)
            {
                FBORenderContext renderContext = this.renderContext;
                if (renderContext != null)
                {
                    renderContext.MakeCurrent();

                    renderContext.SetDimensions(width, height);

                    OpenGL.Viewport(0, 0, width, height);

                    if (this.designMode)
                    {
                        GLCanvasHelper.ResizeGL(width, height);
                    }

                    this.Invalidate();
                }
            }
        }