Ejemplo n.º 1
0
        public void Render(ref Matrix4 projection, ShaderProgram program)
        {
            this.SetupShaderProgram(program, ref projection);
            this.Flush();

            GL.BindVertexArray(this.vba);
            this.context.BindVertexBuffer(this.vertexBuffer);

            GL.DrawArrays(BeginMode.Points, 0, this.elementCount);
            this.elementCount = 0;
        }
        public void Render(ref Matrix4 projection, ShaderProgram program)
        {
            this.SetupShaderProgram(program, ref projection);
            this.Flush();

            GL.BindVertexArray(this.vba);
            this.context.BindIndexBuffer(indexBuffer);
            this.context.BindVertexBuffer(this.vertexBuffer);

            this.context.DrawElements(BeginMode.Triangles, this.elementCount * 6, DrawElementsType.UnsignedInt, 0);

            this.elementCount = 0;
        }
Ejemplo n.º 3
0
        protected override void Load(EntityGUI.GUIFactory factory)
        {
            this.particleProgram = this.Resourses.LoadAsset<ShaderProgram>("Sin.effect");
            this.Panel.BackgroundColor = Color.Gray;

            this.Panel.MouseDown += new EventHandler<EntityGUI.MouseButtonEventArgs>(Panel_MouseDown);
            this.Panel.MouseMove +=new EventHandler<EntityGUI.MouseMoveEventArgs>(Panel_MouseMove);

            particleAtlas = this.Resourses.LoadAsset<TextureAtlas>("Atlases\\Particles.atlas");

            this.systems = new ParticleSystem[10];
            this.emiters = new Emiter2D[10];
            this.Panel_MouseDown(null, null);
        }
Ejemplo n.º 4
0
        private void SetupShaderProgram(ShaderProgram program, ref Matrix4 projection)
        {
            this.context.UseShaderProgram(program);
            program.SetUniform("projection_matrix", ref projection);

            int posIndex = program.GetAttributeLocation("in_position");
            int coloIndex = program.GetAttributeLocation("in_tint");

            GL.BindVertexArray(this.vba);

            this.context.BindVertexBuffer(this.vertexBuffer);
            this.context.EnableVertexAttribArray(posIndex);
            this.context.EnableVertexAttribArray(coloIndex);

            this.context.VertexAttribPointer(posIndex, 2, VertexAttribPointerType.Float,
                                             true, this.vertecies[0].SizeInBytes, 0);

            this.context.VertexAttribPointer(coloIndex, 4, VertexAttribPointerType.UnsignedByte,
                                             true, this.vertecies[0].SizeInBytes, Vector2.SizeInBytes);

            GL.BindVertexArray(0);
        }