public override void DrawOn3DControl() { float width = Config.MapGui.GLControlMap2D.Width; float height = Config.MapGui.GLControlMap2D.Height; (float x1, float z1) = MapUtilities.ConvertCoordsForInGame(0, height / 2); (float x2, float z2) = MapUtilities.ConvertCoordsForInGame(width, height / 2); Map3DVertex[] vertexes = new Map3DVertex[] { new Map3DVertex(new Vector3(x1, -16384, z1), Color4), new Map3DVertex(new Vector3(x2, -16384, z2), Color4), new Map3DVertex(new Vector3(x2, 16384, z2), Color4), new Map3DVertex(new Vector3(x1, 16384, z1), Color4), }; Matrix4 viewMatrix = GetModelMatrix() * Config.Map3DCamera.Matrix; GL.UniformMatrix4(Config.Map3DGraphics.GLUniformView, false, ref viewMatrix); // draw plane { int buffer = GL.GenBuffer(); GL.BindTexture(TextureTarget.Texture2D, MapUtilities.WhiteTexture); GL.BindBuffer(BufferTarget.ArrayBuffer, buffer); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertexes.Length * Map3DVertex.Size), vertexes, BufferUsageHint.DynamicDraw); Config.Map3DGraphics.BindVertices(); GL.DrawArrays(PrimitiveType.Polygon, 0, vertexes.Length); GL.DeleteBuffer(buffer); } // draw outline if (OutlineWidth != 0) { int buffer = GL.GenBuffer(); GL.BindTexture(TextureTarget.Texture2D, MapUtilities.WhiteTexture); GL.BindBuffer(BufferTarget.ArrayBuffer, buffer); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(vertexes.Length * Map3DVertex.Size), vertexes, BufferUsageHint.DynamicDraw); GL.LineWidth(OutlineWidth); Config.Map3DGraphics.BindVertices(); GL.DrawArrays(PrimitiveType.LineLoop, 0, vertexes.Length); GL.DeleteBuffer(buffer); } }