CSharpGL.GLCanvasHelper.ResizeGL C# (CSharp) Метод

ResizeGL() публичный статический Метод

public static ResizeGL ( double width, double height ) : void
width double
height double
Результат void
        public static void ResizeGL(double width, double height)
        {
            //  Set the projection matrix.
            OpenGL.MatrixMode(OpenGL.GL_PROJECTION);

            //  Load the identity.
            OpenGL.LoadIdentity();
            ////  Create a perspective transformation.
            //OpenGL.gluPerspective(60.0f, width / height, 0.01, 100.0);
            mat4 projectionMatrix = glm.perspective(glm.radians(60.0f), (float)(width / height), 0.01f, 100.0f);
            OpenGL.MultMatrixf((projectionMatrix * viewMatrix).ToArray());

            //  Set the modelview matrix.
            OpenGL.MatrixMode(OpenGL.GL_MODELVIEW);
        }

Usage 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();
                }
            }
        }
All Usage Examples Of CSharpGL.GLCanvasHelper::ResizeGL
GLCanvasHelper