Пример #1
0
        private void LoadShaders()
        {
            OGLShader vertexShader   = new OGLShader(ShaderType.VertexShader, Properties.Resources.VertexShader1);
            OGLShader fragmentShader = new OGLShader(ShaderType.FragmentShader, Properties.Resources.FragmentShader1);

            shaderPrograms["UV"] = new OGLShaderProgram(vertexShader, fragmentShader);
        }
Пример #2
0
        public void Set(OGLShaderProgram program)
        {
            // get location of attribute from shader program



            int index = GL.GetAttribLocation(program.Handle, name);

            // enable and set attribute
            GL.EnableVertexAttribArray(index);
            GL.VertexAttribPointer(index, this.size, this.type,
                                   this.normalize, this.stride, this.offset);
        }
Пример #3
0
        public OGLvao(OGLvbo <TVertex> vertexBuffer, OGLShaderProgram program,
                      params VertexAttribute[] attributes)
        {
            // create new vertex array object
            GL.GenVertexArrays(1, out this.handle);

            // bind the object so we can modify it
            this.Bind();

            // bind the vertex buffer object
            vertexBuffer.Bind();
            // set all attributes
            foreach (var attribute in attributes)
            {
                attribute.Set(program);
            }
            // unbind objects to reset state
            GL.BindVertexArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
        }
Пример #4
0
 private void SetShader(Dictionary <string, OGLShaderProgram> shaderPrograms)
 {
     shaderProgram = shaderPrograms["UV"];
 }