-
Notifications
You must be signed in to change notification settings - Fork 4
/
Program.cs
47 lines (34 loc) · 1.06 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace example;
// example-0004
// draw text
//
// - press 'x' to disable texture
// - press 'w' to show triangles ( 2 each char )
class Program
{
static void Main(string[] args)
{
InitAvalonia();
var w = GLWindow.Create();
w.GLModel.BuildModel = (glCtl, isInitial) =>
{
if (!isInitial) return;
var glModel = glCtl.GLModel;
var glCtx = glModel.GLContext;
glModel.Clear();
var txt = new GLText(
// plane xy where text resides ( origin defines the text insertion point )
WCS,
"Eq.1 ( α = γ * φ )")
{
Color = Color.Yellow
};
// to create text we need to use gl context that holds fonts manager
// the resulting figure is a set of triangles textured with the font bitmap
var fig = glCtx.MakeTextFigure(txt);
glModel.AddFigure(fig);
glCtl.CameraView(CameraViewType.FrontTop);
};
w.ShowSync();
}
}