Exemple #1
0
        protected override void DoInitialize()
        {
            this.shaderProgram = InitializeShader();

            InitVAO();

        }
Exemple #2
0
        protected void InitializeShader(out ShaderProgram shaderProgram)
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.AxisElement.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.AxisElement.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

        }
        protected void InitializeShader(out ShaderProgram shaderProgram)
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"VolumeRendering.DemoVolumeRendering04.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"VolumeRendering.DemoVolumeRendering04.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

        }
Exemple #4
0
        protected override void DoInitialize()
        {
            this.shaderProgram = InitializeShader();

            InitVAO();

            this.BeforeRendering += this.GetSimpleUI_BeforeRendering();
            this.AfterRendering += this.GetSimpleUI_AfterRendering();
        }
        public static ShaderProgram GetPickingShaderProgram()
        {
            var vertexShaderSource = GetShaderSource(ShaderTypes.VertexShader);
            string fragmentShaderSource = GetShaderSource(ShaderTypes.FragmentShader);

            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            return shaderProgram;
        }
        protected override void DoInitialize()
        {
            this.shaderProgram = InitializeShader();

            InitVAO();

            this.BeforeRendering += DemoColorCodedPickingElement_BeforeRendering;
            this.BeforeRendering += this.GetIMVPElement_BeforeRendering();
            this.AfterRendering += DemoColorCodedPickingElement_AfterRendering;
            this.AfterRendering += this.GetIMVPElement_AfterRendering();
        }
        //static readonly object synObj = new object();
        public static ShaderProgram GetPickingShaderProgram()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"ColorCodedPicking.PickingShader.vert");
            string fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"ColorCodedPicking.PickingShader.frag");

            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            shaderProgram.AssertValid();

            return shaderProgram;
        }
Exemple #8
0
        private void btnCompile_Click(object sender, EventArgs e)
        {
            try
            {
                this.renderContext.MakeCurrent();

                string vert = this.txtVertexShader.Text;
                string frag = this.txtFragmentShader.Text;
                ShaderProgram program = new ShaderProgram();
                program.Create(vert, frag, null);
                MessageBox.Show("Compiled successfully!");
            }
            catch (Exception ex)
            {
                (new FormTextMsg(ex.Message, "Shader Compile Error")).Show();
            }
        }
        protected void InitializeShader(out ShaderProgram shaderProgram)
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoSimplePointSpriteElement.vert");
            string fragmentShaderSource = string.Empty;
            switch (this.fragShaderType)
            {
                case FragShaderType.Simple:
                    fragmentShaderSource = ManifestResourceLoader.LoadTextFile(
                        @"DemoSimplePointSpriteElement_Simple.frag");
                    break;
                case FragShaderType.Analytic:
                    fragmentShaderSource = ManifestResourceLoader.LoadTextFile(
                        @"DemoSimplePointSpriteElement_Analytic.frag");
                    break;
                default:
                    throw new NotImplementedException();
            }

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

        }
        private void InitShaderProgram()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"WholeFontTextureElement.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"WholeFontTextureElement.frag");
            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            this.shaderProgram = shaderProgram;
        }
        protected ShaderProgram InitializeShader()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoMapBuffer.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoMapBuffer.frag");

            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            shaderProgram.AssertValid();

            return shaderProgram;
        }
        void DemoColorCodedPickingElement_BeforeRendering(object sender, RenderEventArgs e)
        {
            if (e.RenderMode == RenderModes.HitTest)
            {
                this.currentShaderProgram = this.pickingShaderProgram;

            }
            else
            {
                this.currentShaderProgram = this.shaderProgram;
            }
        }
        protected ShaderProgram InitializeShader()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron2Element.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron2Element.frag");

            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            return shaderProgram;
        }
        protected override void DoRender(RenderEventArgs e)
        {
            if (e.RenderMode == RenderModes.HitTest)
            {
                this.currentShaderProgram = this.pickingShaderProgram;
            }
            else
            {
                this.currentShaderProgram = this.shaderProgram;
            }
            ShaderProgram shaderProgram = this.currentShaderProgram;

            shaderProgram.Bind();
            if (shaderProgram == this.pickingShaderProgram)
            {
                shaderProgram.SetUniform("pickingBaseID", ((IColorCodedPicking)this).PickingBaseID);
                shaderProgram.SetUniformMatrix4(strMVP, mvp.to_array());
            }
            else
            {
                shaderProgram.SetUniformMatrix4(strMVP, mvp.to_array());
            }

            GL.Enable(GL.GL_PRIMITIVE_RESTART);
            GL.PrimitiveRestartIndex(uint.MaxValue);

            GL.BindVertexArray(vao[0]);

            //int size = this.size;
            //int count = size * size * size * 15;
            //GL.DrawElements(PrimitiveModes.TriangleStrip, count, GL.GL_UNSIGNED_INT, IntPtr.Zero);
            GL.DrawElements(DrawMode.TriangleStrip, this.count, GL.GL_UNSIGNED_INT, IntPtr.Zero);

            GL.BindVertexArray(0);

            GL.Disable(GL.GL_PRIMITIVE_RESTART);

            shaderProgram.Unbind();
        }
        protected ShaderProgram InitializeShader()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUIColorIndicatorBar.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUIColorIndicatorBar.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            in_PositionLocation = shaderProgram.GetAttributeLocation(strin_Position);
            in_ColorLocation = shaderProgram.GetAttributeLocation(strin_Color);

            return shaderProgram;
        }
Exemple #16
0
        protected ShaderProgram InitializeShader()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUIRect.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"UIs.SimpleUIRect.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            return shaderProgram;
        }
 private void InitShaderProgram()
 {
     //  Create the shader program.
     var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.PointSpriteStringElement.vert");
     var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.PointSpriteStringElement.frag");
     var shaderProgram = new ShaderProgram();
     shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);
     this.attributeIndexPosition = shaderProgram.GetAttributeLocation("in_Position");
     shaderProgram.AssertValid();
     this.shaderProgram = shaderProgram;
 }
Exemple #18
0
        private void InitShaderProgram()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.FontElement.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"SceneElements.FontElement.frag");
            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            shaderProgram.AssertValid();

            this.shaderProgram = shaderProgram;
        }
Exemple #19
0
        protected void InitializeShader(out ShaderProgram shaderProgram)
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoTexImage2D.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoTexImage2D.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

        }
        private void InitProgram()
        {
            {
                var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"TransformFeedback.transform.vert");
                transformProgram = new TransformShaderProgram();
                transformProgram.Create(vertexShaderSource);
                transformProgram.AssertValid();
            }
            {
                var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"TransformFeedback.feedback.vert");
                var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"TransformFeedback.feedback.frag");

                feedbackProgram = new ShaderProgram();
                feedbackProgram.Create(vertexShaderSource, fragmentShaderSource, null);
            }
            {
                var index = GL.GetUniformBlockIndex(transformProgram.ShaderProgramObject, "transform");
                GL.UniformBlockBinding(transformProgram.ShaderProgramObject, index, (uint)UniformType.TRANSFORM0);
            }
        }
 public DemoColorCodedPickingElement(int size)
 {
     this.size = size;
     this.pickingShaderProgram = PickingShaderHelper.GetPickingShaderProgram();
 }
        protected ShaderProgram InitializeShader()
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron1Element.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"DemoHexahedron1Element.frag");

            var shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);

            this.in_PositionLocation = shaderProgram.GetAttributeLocation(strin_Position);
            this.in_ColorLocation = shaderProgram.GetAttributeLocation(strin_Color);
            this.renderWireframeLocation = shaderProgram.GetUniformLocation("renderWirframe");

            return shaderProgram;
        }