static public void Draw(Shader shader, RawModel Modle) { GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f); GL.Clear(ClearBufferMask.ColorBufferBit); shader.Use(); GL.BindVertexArray(Modle.VaoID); GL.EnableVertexAttribArray(0); GL.EnableVertexAttribArray(1); GL.DrawElements(PrimitiveType.Triangles, 6, DrawElementsType.UnsignedInt, 0); GL.DisableVertexAttribArray(0); GL.DisableVertexAttribArray(1); GL.BindVertexArray(0); shader.Stop(); }
protected override void OnLoad(EventArgs e) { triangle = Loader.LoadToVao(vertices, indices, texCoords); //create textures TextureLibary.CreateTexture(@"res\img1.png", "image1"); TextureLibary.CreateTexture(@"res\img2.png", "image2"); //bind them to a texture unit TextureLibary.TexLibary["image1"].Use(0); TextureLibary.TexLibary["image2"].Use(1); //bund the samplers to the texture units Util.DefaultShader.SetData("textureSampler", 0); Util.DefaultShader.SetData("textureSampler2", 1); trans = Maths.CreateTransmatrix(new Vector3(xPos, yPos, 0)); Util.DefaultShader.SetData("transform", trans); //transform model base.OnLoad(e); }