private void Window_Load(object sender, EventArgs e) { texture = ContentPipe.LoadTexture("placeholder.png"); edgeTex = ContentPipe.LoadTexture("edge.png"); blobBuffer.vertBuffer = new Vertex[4] { new Vertex(new Vector2(0, 0), new Vector2(0, 0)), new Vertex(new Vector2(0, 1), new Vector2(0, 1)), new Vertex(new Vector2(1, 1), new Vector2(1, 1)), new Vertex(new Vector2(1, 0), new Vector2(1, 0)) }; edgeBuffer.VBO = GL.GenBuffer(); edgeBuffer.IBO = GL.GenBuffer(); blobBuffer.VBO = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, blobBuffer.VBO); GL.BufferData <Vertex>(BufferTarget.ArrayBuffer, (IntPtr)(Vertex.SizeInBytes * blobBuffer.vertBuffer.Length), blobBuffer.vertBuffer, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); blobBuffer.indexBuffer = new uint[4] { 0, 1, 2, 3 }; blobBuffer.IBO = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ElementArrayBuffer, blobBuffer.IBO); GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(uint) * (blobBuffer.indexBuffer.Length)), blobBuffer.indexBuffer, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); }
public TextWriter(string imageFileLocation) { text = ContentPipe.LoadTexture("Alphabet/selected.png"); punc = new Texture2D[6]; alphabet = new Texture2D[symbols.Length]; for (int i = 0; i < symbols.Length; i++) { alphabet[i] = ContentPipe.LoadTexture(string.Concat(imageFileLocation, symbols[i] + ".png")); } punc[space] = ContentPipe.LoadTexture(imageFileLocation + "\\Space.png"); punc[point] = ContentPipe.LoadTexture(imageFileLocation + "\\Point.png"); punc[comma] = ContentPipe.LoadTexture(imageFileLocation + "\\Comma.png"); punc[openP] = ContentPipe.LoadTexture(imageFileLocation + "\\OpenParanthese.png"); punc[closedP] = ContentPipe.LoadTexture(imageFileLocation + "\\ClosedParanthese.png"); punc[dPoint] = ContentPipe.LoadTexture(imageFileLocation + "\\doublePoint.png"); buffer.indexBuffer = new uint[4]; buffer.vertBuffer = new Vertex[4]; buffer.IBO = GL.GenBuffer(); buffer.VBO = GL.GenBuffer(); for (int i = 0; i < buffer.indexBuffer.Length; i++) { buffer.indexBuffer[i] = (uint)i; } buffer.vertBuffer[0] = new Vertex(new Vector2(0, 0), new Vector2(0, 0)); buffer.vertBuffer[1] = new Vertex(new Vector2(1, 0), new Vector2(1, 0)); buffer.vertBuffer[2] = new Vertex(new Vector2(1, 1), new Vector2(1, 1)); buffer.vertBuffer[3] = new Vertex(new Vector2(0, 1), new Vector2(0, 1)); BufferFill(buffer); sel.indexBuffer = new uint[4]; sel.vertBuffer = new Vertex[4]; sel.IBO = GL.GenBuffer(); sel.VBO = GL.GenBuffer(); for (int i = 0; i < sel.indexBuffer.Length; i++) { sel.indexBuffer[i] = (uint)i; } sel.vertBuffer[0] = new Vertex(new Vector2(0, 0), new Vector2(0, 0)) { Color = Color.Orange }; sel.vertBuffer[1] = new Vertex(new Vector2(1, 0), new Vector2(1, 0)) { Color = Color.Orange }; sel.vertBuffer[2] = new Vertex(new Vector2(1, 1), new Vector2(1, 1)) { Color = Color.Orange }; sel.vertBuffer[3] = new Vertex(new Vector2(0, 1), new Vector2(0, 1)) { Color = Color.Orange }; BufferFill(sel); }