Ich erstelle ein Graph-Zeichenprogramm mit OpenTK, um meine Computergrafik Übung abzuschließen.Schreibe Text in OpenTK
Das Problem ist, ich Text schreiben müssen glcontrol Punkt Koordinaten nur, wie dieses Bild, um anzuzeigen:
Bitte um Hilfe!
Hier ist mein Code:
private void glControl1_Paint(object sender, PaintEventArgs e)
{
if (!loaded) // Play nice
return;
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.LineWidth(2);
DrawingObjects.DrawOxy(leftOr, rightOr, topOr, bottomOr);
color = Color.Red;
GL.Color3(color);
glControl1.SwapBuffers();
}
public static void DrawOxy(int lO, int rO, int tO, int bO)
{
GL.Color3(Color.Blue);
GL.Begin(BeginMode.Lines);
GL.Vertex2(lO, 0);
GL.Vertex2(rO, 0);
GL.Vertex2(0, tO);
GL.Vertex2(0, bO);
for (int i = lO; i < rO; i+=2)
{
GL.Vertex2(i, 0.5);
GL.Vertex2(i, -0.5);
}
for (int j = bO; j < tO; j+=2)
{
GL.Vertex2(0.2, j);
GL.Vertex2(-0.2, j);
}
GL.End();
}
Tut mir leid, mein Englisch!
nichts bisher. Ich wusste nicht, wo ich anfangen soll :( – tuankhoa1996
Als Ausgangspunkt: OpenGL versteht nichts von "text", opengl kennt nur Polygone und Texturen, also müssen Sie eine Textur mit der gerenderten Schriftart erstellen und diese dann abbilden Textur zu Polygonen – Gusman
War meine Antwort hilfreich? Ich kann mir andere Lösungen vorstellen, aber das ist definitiv die einfachste und robusteste. –