|
Text 3D
Implementation
Zur Ausgabe von Text sind nur folgende Schritte nötig
- Drawing3d.Font Font = new Drawing3d.Font("Times New Roman");
- Darstellen: z.B.: Device.DrawText(new xyz(2,2,0),"OpenGl is nice");
Die Device bietet noch folgende Methoden an:
- GetTextExtent: Liefert ein umschießendes Rechteck
- Italic : Setzen von Fontstyle auf Italic
Beispiel
DeviceCreated
// Feld der Device
Drawing3d.Font Font = new Drawing3d.Font("Times New Roman");
protected override void OnCreated()
{
base.OnCreated();
BackColor = Color.White;
FieldOfView = 30;
Font.FontSize = 4;
}
DevicePaint
public override void OnPaint()
{
base.OnPaint();
// Material
Material = Materials.Gold;
Font.FontStyle = FontStyle.Italic;
xy B = getEnvText(Font, "OpenGL is nice");
// Zentrieren
drawText(Font, new xyz(-B.x / 2, 0, 0), "OpenGL is nice", 1.5);
}
Und so siehts aus:
|
|