public void Render(Matrix4 Mvp) { var shaderObj = ShaderObjectSingleton.GetByName(ShaderName); GL.UseProgram(shaderObj.ProgramId); Bind(); GL.UniformMatrix4(shaderObj.MatrixShaderLocation, false, ref Mvp); GL.DrawElements(PrimitiveType.Triangles, Indices.Length, DrawElementsType.UnsignedInt, 0); }
/// <summary> /// /// </summary> /// <param name="scale"></param> /// <param name="frame">Must be >= 0 and < TexCount.</param> /// <param name="flip">Flips horizontally.</param> public static void RenderFromCorner(SpriteTextureObject spriteTexture, Matrix4 baseMvp, string shaderName, double scale, int frame) { Matrix4 finalMatrix = baseMvp; finalMatrix = Matrix4.CreateScale((float)scale, (float)scale, 1.0f) * finalMatrix; var shaderObj = ShaderObjectSingleton.GetByName(shaderName); GL.UseProgram(shaderObj.ProgramId); Bind(); GL.UniformMatrix4(shaderObj.MatrixShaderLocation, false, ref finalMatrix); GL.BindTexture(TextureTarget.Texture2D, spriteTexture.TextureIds[frame]); GL.DrawElements(PrimitiveType.Triangles, Indices.Length, DrawElementsType.UnsignedInt, 0); GL.BindTexture(TextureTarget.Texture2D, -1); }