Ejemplo n.º 1
0
        public void Render()
        {
            if (isValid < 0)
            {
                CheckValidity();
            }

            if (isValid > 0)
            {
                Log.WriteLine("Cannot render. Renderable is not valid.", LogType.Warning);
                return;
            }

            //if (shader.Uniforms.Count(uniform => uniform.Type == UniformType.Texture2D) != textures.Length) {
            //    Log.WriteLine("Cannot render. Texture count does not match uniform texture count in shader.");
            //    return;
            //}

            Clean();

            shader.Bind();
            shader.EnableVertexAttributes();

            this.uniformAssigner.AssignUniforms(this.shader, this.shaderUniformAssignmentHandler);

            vbo.Bind();
            shader.AssignVertexAttributePointers();
            vbo.Release();

            GLHandler.Instance.Render(ibo);

            foreach (Texture textureUniform in this.uniformAssigner.TextureUniforms)
            {
                textureUniform.Release();
            }

            shader.DisableVertexAttributes();
            shader.Release();
        }