Ejemplo n.º 1
0
        public void RenderObject(VertexBufferObject <Vertex> vbo, VertexArrayObject <Vertex> vao, int shaderIndex, Matrix4 modelTransform, int textureIndex)
        {
            ApplySettingsNow();
            if (!depthteston)
            {
                GL.Enable(EnableCap.DepthTest);
                depthteston = true;
            }
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            shaderMgr.InitialiseAShader(shaderIndex);
            Uniform.Matrix4Uniform model = new Uniform.Matrix4Uniform("model");
            model.Matrix = modelTransform;
            Uniform.Matrix4Uniform view = new Uniform.Matrix4Uniform("view");
            view.Matrix = cameraMgr.GetActiveCamera().GetVeiwMatrix();
            Uniform.Matrix4Uniform projection = new Uniform.Matrix4Uniform("projection");
            projection.Matrix = GetProjectionMatrix();
            Shader shader = shaderMgr.GetShader(shaderIndex);

            shader.Use();
            model.Set(shader);
            view.Set(shader);
            projection.Set(shader);
            GL.ActiveTexture(TextureUnit.Texture0);
            textureMgr.GetTexture(textureIndex).BindTexture();
            textureMgr.GetTexture(textureIndex).ActivateTexture(TextureUnit.Texture0, shader, "theTexture", 0);
            vao.Bind();
            vbo.BindBuffer();
            vbo.Draw(PrimitiveType.Triangles);
        }
Ejemplo n.º 2
0
        public void RenderObject(VertexBufferObject <Vertex> vbo, VertexArrayObject <Vertex> vao, int shaderIndex, Matrix4 modelTransform)
        {
            ApplySettingsNow();
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            shaderMgr.InitialiseAShader(shaderIndex);
            Uniform.Matrix4Uniform model = new Uniform.Matrix4Uniform("model");
            model.Matrix = modelTransform;
            Uniform.Matrix4Uniform view = new Uniform.Matrix4Uniform("view");
            view.Matrix = cameraMgr.GetActiveCamera().GetVeiwMatrix();
            Uniform.Matrix4Uniform projection = new Uniform.Matrix4Uniform("projection");
            projection.Matrix = GetProjectionMatrix();
            Shader shader = shaderMgr.GetShader(shaderIndex);

            shader.Use();
            model.Set(shader);
            view.Set(shader);
            projection.Set(shader);
            vao.Bind();
            vbo.BindBuffer();
            vbo.Draw(PrimitiveType.Triangles);
        }