Update ProjMatrix. OpenGL 3.1, C#

Published February 28, 2019
Advertisement

This example show how to update projection matrix: Blackjack_WinFormsOpenGL31CSharp_UpdateProjMatrix.zip


        private void glControl_Resize(object sender, EventArgs e)
        {
            UpdateProjMatrix();
        }

        private void UpdateProjMatrix()
        {
            float aspect = (float)glControl.Width / glControl.Height;
            float worldWidth = aspect * _worldHeight;
            // Define the project matrix
            Matrix4 projMatrix = Matrix4.CreateOrthographic(worldWidth, _worldHeight, 0.1f, 1000f);
            GL.UniformMatrix4(_uProjMatrixLoc, false, ref projMatrix);
        }

Blackjack_WinFormsOpenGL31CSharp_UpdateProjMatrix_Big.gif.75757ccb09d2a6fb258bcdcd6d585db9.gif

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement