コード例 #1
0
        void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            PrintCameraInfo();

            GL.ClearColor(0x87 / 255.0f, 0xce / 255.0f, 0xeb / 255.0f, 0xff / 255.0f);
            GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

            var arg = new RenderEventArgs(RenderModes.Render, this.camera);

            if (this.renderState == 2 || this.renderState == 4)
            {
                axisElement.Render(arg);
            }

            if (this.renderState == 3 || this.renderState == 4)
            {
                axisElement2.Render(arg);
            }

            uiLeftBottomAxis.Render(arg);
            uiLeftTopAxis.Render(arg);
            uiRightBottomAxis.Render(arg);
            uiRightTopAxis.Render(arg);

            uiLeftBottomRect.Render(arg);
            uiLeftTopRect.Render(arg);
            uiRightBottomRect.Render(arg);
            uiRightTopRect.Render(arg);
        }
コード例 #2
0
        void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            PrintCameraInfo();

            //GL.ClearColor(0x87 / 255.0f, 0xce / 255.0f, 0xeb / 255.0f, 0xff / 255.0f);
            GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

            var  arg = new RenderEventArgs(RenderModes.Render, this.camera);
            mat4 projectionMatrix = camera.GetProjectionMat4();

            projectionMatrix = glm.translate(projectionMatrix, new vec3(translateX, translateY, translateZ));//
            mat4 viewMatrix  = camera.GetViewMat4();
            mat4 modelMatrix = mat4.identity();
            mat4 mvp         = projectionMatrix * viewMatrix * modelMatrix;

            if (this.renderState == 2 || this.renderState == 4)
            {
                axisElement.mvp = mvp;

                axisElement.Render(arg);
            }

            if (this.renderState == 3 || this.renderState == 4)
            {
                axisElement2.projectionMatrix = projectionMatrix;
                axisElement2.viewMatrix       = viewMatrix;
                axisElement2.modelMatrix      = modelMatrix;

                axisElement2.Render(arg);
            }

            uiLeftBottomAxis.Render(arg);
            uiLeftTopAxis.Render(arg);
            uiRightBottomAxis.Render(arg);
            uiRightTopAxis.Render(arg);

            uiLeftBottomRect.Render(arg);
            uiLeftTopRect.Render(arg);
            uiRightBottomRect.Render(arg);
            uiRightTopRect.Render(arg);
        }