- Matrix4 mvp = Matrix4.CreateOrthographicOffCenter(0.0f, 320.0f, 240.0f, 0.0f, -0.3f, 100.0f);
- GL.UseProgram(GameDelegate.programs["Text"].prog);
- GL.UniformMatrix4(GameDelegate.programs["Text"].uniforms["modelViewProjectionMatrix"],false,ref mvp);
- fontTexture.Bind(TextureUnit.Texture0);
- int test = GameDelegate.programs["Text"].attributes["texcoord"];
- GL.EnableVertexAttribArray(GameDelegate.programs["Text"].attributes["texcoord"]);
- GL.EnableVertexAttribArray(GameDelegate.programs["Text"].attributes["vertex_position"]);
- GL.Uniform1(GameDelegate.programs["Text"].uniforms["texture"],0);
- for (int i = 0; i < text.Length; i++)
- {
- int c = text[i];
- float[] tc = new float[] {
- 0.0625f * (c % 16),0.0625f * (c/16),
- 0.0625f * (c % 16) + 0.0625f,0.0625f * (c/16),
- 0.0625f * (c % 16) + 0.0625f,0.0625f * (c % 16) + 0.0625f,
- 0.0625f * (c % 16),0.0625f * (c % 16) + 0.0625f,
- };
- float[] vert = new float[] {
- posx + i * size, posy,
- posx + i * size + size,posy,
- posx + i * size + size,posy + size,
- posx + i * size,posy + size
- };
- int[] indicies = new int[] {
- 3,2,1,0
- };
- GL.VertexAttribPointer(GameDelegate.programs["Text"].attributes["texcoord"], 2, VertexAttribPointerType.Float, false, sizeof(float), tc);
- GL.VertexAttribPointer(GameDelegate.programs["Text"].attributes["vertex_position"], 2, VertexAttribPointerType.Float, false, sizeof(float), vert);
- GL.DrawElements(BeginMode.Quads, 4, DrawElementsType.UnsignedInt, indicies);
- }
- GL.DisableVertexAttribArray(GameDelegate.programs["Text"].attributes["vertex_position"]);
- GL.DisableVertexAttribArray(GameDelegate.programs["Text"].attributes["texcoord"]);
- fontTexture.UnBind(TextureUnit.Texture0);