public void OnUpdate() { //base.OnInitialize(); string text = "Test text! "+Engine.current.deltaTime; Font font = new Font("Verdana", 12, FontStyle.Regular, GraphicsUnit.Point); Bitmap measureBitmap = new Bitmap(2, 2); Bitmap bitmap = null; System.Drawing.Graphics measureGraphics = System.Drawing.Graphics.FromImage(measureBitmap); measureGraphics.PageUnit = GraphicsUnit.Pixel; measureGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; measureGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; SizeF size = measureGraphics.MeasureString(text, font); measureGraphics.Dispose(); measureBitmap.Dispose(); bitmap = new Bitmap((int)size.Width, (int)size.Height); System.Drawing.Graphics drawGraphics = System.Drawing.Graphics.FromImage(bitmap); drawGraphics.PageUnit = GraphicsUnit.Pixel; drawGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; drawGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; drawGraphics.Clear(System.Drawing.Color.FromArgb(255, 0, 0, 0)); drawGraphics.DrawString(text, font, new SolidBrush(System.Drawing.Color.White), 0, 0); drawGraphics.Dispose(); if (texture) { texture.Dispose(); } texture = new Texture2D(bitmap, false, Texture2D.MemoryResidence.GPU); bitmap.Dispose(); if (mesh) { mesh.Dispose(); } positionVboData[0] = new Vector3f(0, 0, 0); positionVboData[1] = new Vector3f(0, texture.height, 0); positionVboData[2] = new Vector3f(texture.width, texture.height, 0); positionVboData[3] = new Vector3f(texture.width, 0, 0); mesh = new Mesh(); mesh.AddBuffer<VertexBufferObject3f>("vertex"); mesh.SetBuffer3f("vertex", positionVboData); mesh.AddBuffer<VertexBufferObject3f>("normal"); mesh.SetBuffer3f("normal", normalVboData); mesh.AddBuffer<VertexBufferObject2f>("uv0"); mesh.SetBuffer2f("uv0", uvVboData); mesh.SetIndices(indicesVboData, 0, Graphics.PrimitiveType.Triangles); MeshRenderer meshRenderer = sceneObject.GetModule<MeshRenderer>(); if (meshRenderer) { MaterialProperties properties = new MaterialProperties(); MaterialPropertyTexture2D texProperty = properties.AddProperty<MaterialPropertyTexture2D>("colorTexture"); texProperty.value = texture; meshRenderer.mesh = mesh; meshRenderer.overrideProperties = properties; } }