public void Init(ShaderProgram shader)
        {
            Console.WriteLine("Initilising graph");
            gfx_model   = MatrixCollection.CreateInitialMatricies();
            textObjects = new List <GfxTextNode2D>();

            //attribute_vpos = shader.GetAttribLocation("vPosition");
            //attribute_vcol = shader.GetAttribLocation("vColor");

            //GL.GenBuffers(1, out vbo_position);
            //GL.GenBuffers(1, out vbo_color);

            //GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position);
            //GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, (IntPtr)(vertdata.Length * Vector3.SizeInBytes), vertdata, BufferUsageHint.StaticDraw);
            //GL.VertexAttribPointer(attribute_vpos, 3, VertexAttribPointerType.Float, false, 0, 0);

            //GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_color);
            //GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, (IntPtr)(coldata.Length * Vector3.SizeInBytes), coldata, BufferUsageHint.StaticDraw);
            //GL.VertexAttribPointer(attribute_vcol, 3, VertexAttribPointerType.Float, true, 0, 0);

            //// Validate that the buffer is the correct size
            //int bufferSize;
            //GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out bufferSize);
            //if (coldata.Length * Vector3.SizeInBytes != bufferSize)
            //    throw new ApplicationException("Vertex array not uploaded correctly");

            //GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
        }
        public static MatrixCollection CreateInitialMatricies(INativeWindow window)
        {
            MatrixCollection mc = new MatrixCollection();

            mc.modelview = Matrix4.Identity;
            //mc.modelview = Matrix4.LookAt(Vector3.UnitX, Vector3.UnitZ, Vector3.UnitY);
            mc.projection = CreatePerspectiveFieldOfView(window);

            return(mc);
        }
        public static MatrixCollection CreateInitialMatricies()
        {
            MatrixCollection mc = new MatrixCollection();

            mc.modelview = Matrix4.Identity;
            //mc.modelview = Matrix4.LookAt(Vector3.UnitX, Vector3.UnitZ, Vector3.UnitY);
            mc.projection = Matrix4.Identity;

            return(mc);
        }
        protected override void OnLoad(EventArgs e)
        {
            // SCENE
            string info = "[Vendor] " + GL.GetString(StringName.Vendor) + " "
                          + "[Version] " + GL.GetString(StringName.Version) + "\n"
                          + "[Renderer] " + GL.GetString(StringName.Renderer) + "\n"
                          + "[ShadingLanguageVersion] " + GL.GetString(StringName.ShadingLanguageVersion) + "\n"
                          + "[Extensions] " + GL.GetString(StringName.Extensions)
            ;

            Console.WriteLine(info);

            GL.ClearDepth(1.0f);                 // Depth Buffer Setup
            GL.Enable(EnableCap.DepthTest);      // Enables Depth Testing
            GL.ClearColor(OpenTK.Graphics.Color4.Black);
            GL.PointSize(5f);

            /* load shaders */
            var shaders = new List <Shader>();

            shaders.Add(new VertexShader {
                FileName = System.IO.Path.GetFullPath(@base + "SceneGraphVertex.shader")
            });
            shaders.Add(new FragmentShader {
                FileName = System.IO.Path.GetFullPath(@base + "SceneGraphFragment.shader")
            });
            shader = ShaderProgram.CreateLoadAndLinkProgram(shaders);

            /* bind shader variables, and bind buffers */
            gfx_model = MatrixCollection.CreateInitialMatricies(window: this);
            gfx_model.GetMatrixUniforms(shader);

            RebuildLayout();

            base.OnLoad(e);
        }
 public static void PushMatrix(MatrixCollection m)
 {
     //GL.PushMatrix();
     k.Push(m);
 }