SetUniform() public method

public SetUniform ( string name, Matrix4 m ) : void
name string
m Matrix4
return void
Exemplo n.º 1
0
        public Mesh(Shader shader = null, int numberOfAxis = 2)
        {
            this.customBuffers = new Dictionary <int, VertexAttrib>();
            this.numberOfAxis  = numberOfAxis;

            // use VAO if possible
            this.vertexArrayId = Graphics.NewArray();
            if (this.vertexArrayId > -1)
            {
                this.Bind();
            }

            // vertex
            this.vBufferId = Graphics.NewBuffer();
            Graphics.MapBufferToArray(this.vBufferId, 0, numberOfAxis);

            // uv
            this.uvBufferId = Graphics.NewBuffer();
            Graphics.MapBufferToArray(this.uvBufferId, 1, 2);

            // vc
            this.vcBufferId = Graphics.NewBuffer();
            Graphics.MapBufferToArray(this.vcBufferId, 2, 4);

            if (shader == null)
            {
                shader = simpleShader;
                shader.SetUniform("tex", 0);
            }

            this.shader = shader;

            this.noMatrix          = false;
            this.hasVertexColors   = true;
            this.requireUseTexture = true;
        }
Exemplo n.º 2
0
        public Mesh(Shader shader = null)
        {
            this.customBuffers = new Dictionary<int, VertexAttrib>();

            // use VAO if possible
            this.vertexArrayId = NewVAO();
            if (this.vertexArrayId > -1)
            {
                this.Bind();
            }

            // vertex
            this.vBufferId = NewVBO();
            GL.BindBuffer(BufferTarget.ArrayBuffer, this.vBufferId);
            int vertexAttribId = 0;
            GL.EnableVertexAttribArray(vertexAttribId);
            GL.VertexAttribPointer(vertexAttribId, 2, VertexAttribPointerType.Float, false, 0, IntPtr.Zero);

            // uv
            this.uvBufferId = NewVBO();
            GL.BindBuffer(BufferTarget.ArrayBuffer, this.uvBufferId);
            int uvAttribId = 1;
            GL.EnableVertexAttribArray(uvAttribId);
            GL.VertexAttribPointer(uvAttribId, 2, VertexAttribPointerType.Float, false, 0, IntPtr.Zero);

            // vc
            this.vcBufferId = NewVBO();
            GL.BindBuffer(BufferTarget.ArrayBuffer, this.vcBufferId);
            int vcAttribId = 2;
            GL.EnableVertexAttribArray(vcAttribId);
            GL.VertexAttribPointer(vcAttribId, 4, VertexAttribPointerType.Float, false, 0, IntPtr.Zero);

            if (shader == null)
            {
                shader = simpleShader;
                shader.SetUniform("tex", 0);
            }

            this.shader = shader;

            this.noMatrix = false;
            this.hasVertexColors = true;
            this.requireUseTexture = true;
        }