openGL 绘制文本font(csGL)

 1 static Font f = new Font("Times New Roman", 15, FontStyle.Regular);//Times New Roman
 2         GDITextureFont myFont = new GDITextureFont(f);
 3         /// 
 4         /// GDI Font(has fault)
 5         /// 
 6         private void draw_font(float x,float y,float z,string str)
 7         {            
 8             GL.glColor3f(1, 1, 0.8f);
 9             GL.glPushMatrix();
10             GL.glTranslatef(x, y, z);
11             myFont.DrawString(str);
12             GL.glPopMatrix();
13         }
14         /// 
15         /// GDI Font
16         /// 
17         private void draw_font(int x, int y, string str)
18         {            
19             GL.glColor3f(0.0f, 1, 0f);
20             GL.glPushMatrix();            
21             myFont.Draw2DString(str, x, y);
22             GL.glPopMatrix();
23         }

 

转载于:https://www.cnblogs.com/Lemon-Li/p/3254133.html

你可能感兴趣的:(openGL 绘制文本font(csGL))