Hello everyone! How to draw with gl triangles with certain texture coordinates?
When I use this code, a circle texture looks like stripes, but I expected this will become tiled circles without any distortion. Thanks in advance!
usingUnityEngine;
[ExecuteInEditMode]
publicclass GlUvTest:MonoBehaviour
{
public Material mat;
void Update()
{
transform.position=new Vector3(0, 5.621685f, -8.10467f);
}
void OnPostRender()
{
if(mat==null)
return;
mat.SetPass(0);
GL.Begin(GL.TRIANGLES);
GL.Color(Color.white);
GL.Vertex3(0, 1, 0);
GL.TexCoord2(0, 1);
GL.Vertex3(0.5f, 10f, 0);
GL.TexCoord2(0.5f, 10);
GL.Vertex3(1, 1, 0);
GL.TexCoord2(1, 1);
GL.End();
}
}