public override void Dispose() { Log.WriteDebugLine("Disposed: " + Name); if (texture != null) { texture.Dispose(); } if (vbo != null) { vbo.Dispose(); } texture = null; vbo = null; }
/// <summary> /// lataa kuva. /// </summary> /// <param name="fileName"></param> public void Load(string fileName) { texture = Texture.Load(fileName); int[] ind = new int[] { 0, 1, 3, 1, 2, 3 }; int w = texture.Width / 2; int h = texture.Height / 2; Vector3[] vs = new Vector3[] { new Vector3(-w, -h, 0), new Vector3(-w, h, 0), new Vector3(w, h, 0), new Vector3(w, -h, 0) }; Vector2[] uv = new Vector2[] { new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0) }; Vector3[] norm = new Vector3[] { new Vector3(0, 0, 1), new Vector3(0, 0, 1), new Vector3(0, 0, 1), new Vector3(0, 0, 1) }; vbo = new VBO(); vbo.DataToVBO(vs, ind, norm, uv); // scale Front.X = 1; Front.Y = 1; }
public override void Dispose() { Log.WriteDebugLine("Disposed: " + Name); if (texture != null) texture.Dispose(); if (vbo != null) vbo.Dispose(); texture = null; vbo = null; }
/// <summary> /// lataa kuva. /// </summary> /// <param name="fileName"></param> public void Load(string fileName) { texture = Texture.Load(fileName); int[] ind = new int[] { 0, 1, 3, 1, 2, 3 }; int w = texture.Width / 2; int h = texture.Height / 2; Vector3[] vs = new Vector3[] { new Vector3(-w, -h,0), new Vector3(-w, h,0), new Vector3(w, h,0), new Vector3(w, -h,0) }; Vector2[] uv = new Vector2[] { new Vector2(1,0), new Vector2(1,1), new Vector2(0,1), new Vector2(0,0) }; Vector3[] norm = new Vector3[] { new Vector3(0, 0, 1), new Vector3(0, 0, 1), new Vector3(0, 0, 1), new Vector3(0, 0, 1) }; vbo = new VBO(); vbo.DataToVBO(vs, ind, norm, uv); // scale Front.X = 1; Front.Y = 1; }