コード例 #1
0
        public TestVisualObject(SimpleShader simpleShader, Color4 color) : base(color)
        {
            SimpleShader = simpleShader;


            vId = GL.GenBuffer();
            vao = GL.GenVertexArray();
            GL.BindVertexArray(vao);

            GL.UseProgram(SimpleShader.ProgramId);

            var vertexPos = SimpleShader.GetAttribLocation("position");

            GL.BindBuffer(BufferTarget.ArrayBuffer, vId);
            GL.VertexAttribPointer(vertexPos, 2, VertexAttribPointerType.Float, false, Vector2.SizeInBytes, IntPtr.Zero);
            GL.EnableVertexAttribArray(vertexPos);
        }
コード例 #2
0
ファイル: DrawingVisual.cs プロジェクト: olegbom/LinearCodes
        public DrawingVisual(SimpleShader simpleShader)
        {
            SimpleShader = simpleShader;
            InstasingList.CollectionChanged += (s, e) =>
            {
                if (e.NewItems == null)
                {
                    return;
                }
                foreach (VisualUniforms visualUniformse in e.NewItems)
                {
                    visualUniformse.ParentModelMatrix = _modelMatrix;
                }
            };

            Childrens.CollectionChanged += (s, e) =>
            {
                if (e.NewItems == null)
                {
                    return;
                }
                foreach (DrawingVisual drawingVisual in e.NewItems)
                {
                    drawingVisual.ParentModelMatrix = _modelMatrix;
                }
            };

            vId = GL.GenBuffer();
            vao = GL.GenVertexArray();
            GL.BindVertexArray(vao);

            GL.UseProgram(SimpleShader.ProgramId);

            var vertexPos = SimpleShader.GetAttribLocation("position");

            GL.BindBuffer(BufferTarget.ArrayBuffer, vId);
            GL.VertexAttribPointer(vertexPos, 2, VertexAttribPointerType.Float, false, Vector2.SizeInBytes, IntPtr.Zero);
            GL.EnableVertexAttribArray(vertexPos);
        }