public virtual void DrawTexture(Texture tex)
{
if (this.v == null || this.uv == null)
return;
// upload fake vcs (if required) to avoid crashes
if (this.vc == null && this.hasVertexColors)
{
this.vc = new float[this.v.Length * 2];
this.UpdateVertexColor();
}
this.Bind();
tex.Bind();
if (this.requireUseTexture)
this.shader.SetUniform("use_texture", 1f);
this.shader.Use();
if (this.shaderSetupHook != null)
{
this.shaderSetupHook(this);
}
this.ApplyMatrix();
if (instances <= 1)
{
#if !__MOBILE__
GL.DrawArrays(PrimitiveType.Triangles, 0, this.v.Length / 2);
#else
GL.DrawArrays(BeginMode.Triangles, 0, this.v.Length / 2);
#endif
}
else
{
GL.DrawArraysInstanced(PrimitiveType.Triangles, 0, this.v.Length / 2, instances);
}
}