Example #1
0
        protected void InitializeShader(out ShaderProgram shaderProgram)
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"Renderers.Cloud.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"Renderers.Cloud.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);
        }
Example #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);

        }
        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;
        }
Example #5
0
        //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;
        }
Example #6
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);

        }
        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 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;
        }
Example #10
0
        } // end sub

        #endregion

        protected override void DoInitialize()
        {
            // Now create a simple program to visualize the result
            shaderProgram = new ShaderProgram();
            shaderProgram.Create(render_vs, render_fs, null);

            //mv_mat_loc = GL.GetUniformLocation(shaderProgram.ShaderProgramObject, "model_matrix");
            //prj_mat_loc = GL.GetUniformLocation(shaderProgram.ShaderProgramObject, "proj_matrix");
            //col_amb_loc = GL.GetUniformLocation(shaderProgram.ShaderProgramObject, "color_ambient");
            //col_diff_loc = GL.GetUniformLocation(shaderProgram.ShaderProgramObject, "color_diffuse");
            //col_spec_loc = GL.GetUniformLocation(shaderProgram.ShaderProgramObject, "color_specular");

            vboObject.LoadFromVBM(@"media\unit_torus.vbm", 0, 1, 2);

            base.BeforeRendering += LightingExample_BeforeRendering;
            base.AfterRendering += LightingExample_AfterRendering;
        }
 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;
 }
Example #12
0
        protected override void DoInitialize()
        {
            // Now create a simple program to visualize the result
            basicShaderProgram = new ShaderProgram();
            basicShaderProgram.Create(basicVertexShader, basicFragmentShader, null);
            basicShaderProgram.AssertValid();
            base_model_matrix_pos = GL.GetUniformLocation(basicShaderProgram.ShaderProgramObject, "model_matrix");
            base_projection_matrix_pos = GL.GetUniformLocation(basicShaderProgram.ShaderProgramObject, "projection_matrix");

            fur_prog = GL.CreateProgram();
            ShaderHelper.vglAttachShaderSource(fur_prog, ShaderType.VertexShader, furVertexShader);
            ShaderHelper.vglAttachShaderSource(fur_prog, ShaderType.GeometryShader, furGeometryShader);
            ShaderHelper.vglAttachShaderSource(fur_prog, ShaderType.FragmentShader, furFragmentShader);
            GL.LinkProgram(fur_prog);
            GL.UseProgram(fur_prog);
            fur_model_matrix_pos = GL.GetUniformLocation(fur_prog, "model_matrix");
            fur_projection_matrix_pos = GL.GetUniformLocation(fur_prog, "projection_matrix");

            GL.GenTextures(1, fur_texture);
            UnmanagedArray<byte> tex = new UnmanagedArray<byte>(1024 * 1024 * 4);
            Random random = new Random();
            for (int n = 0; n < 256; n++)
            {
                for (int m = 0; m < 1270; m++)
                {
                    int x = random.Next() & 0x3FF;
                    int y = random.Next() & 0x3FF;
                    tex[(y * 1024 + x) * 4 + 0] = (byte)((random.Next() & 0x3F) + 0xC0);
                    tex[(y * 1024 + x) * 4 + 1] = (byte)((random.Next() & 0x3F) + 0xC0);
                    tex[(y * 1024 + x) * 4 + 2] = (byte)((random.Next() & 0x3F) + 0xC0);
                    tex[(y * 1024 + x) * 4 + 3] = (byte)(n);
                    //tex[(y * 1024 + x) * 4 + 0] = (byte)(random.Next());
                    //tex[(y * 1024 + x) * 4 + 1] = (byte)(random.Next());
                    //tex[(y * 1024 + x) * 4 + 2] = (byte)(random.Next());
                    //tex[(y * 1024 + x) * 4 + 3] = (byte)(random.Next());
                }
            }
            GL.BindTexture(GL.GL_TEXTURE_2D, fur_texture[0]);
            GL.TexImage2D(TexImage2DTargets.Texture2D, 0, TexImage2DFormats.RGBA, 1024, 1024, 0, TexImage2DFormats.RGBA, TexImage2DTypes.UnsignedByte, tex.Header);
            GL.TexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, (int)GL.GL_LINEAR);
            GL.TexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, (int)GL.GL_LINEAR);
            tex.Dispose();

            vboObject.LoadFromVBM(@"media\ninja.vbm", 0, 1, 2);

            base.BeforeRendering += LightingExample_BeforeRendering;
            base.AfterRendering += LightingExample_AfterRendering;
        }
Example #13
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;
        }
Example #14
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);

            shaderProgram.AssertValid();
        }
Example #15
0
        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;
        }
        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);
            }
        }
        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;
        }
        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;
        }
Example #19
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;
        }