
How to use WriteStringAt() from TexLib to print text
Posted Thursday, 1 July, 2010 - 17:26 by jjgl| Project: | OpenTK.Text |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | open |
Jump to:
Description
Can anyone tell me what I did wrong with following function to print text on viewport? I read a few early discussions but still could not get it work.
Thanks.
private void DrawText_01() { //string text = string.Format("Hello! FPS={0:000.0}", fps); GL.Color3(Color.Khaki); TexUtil.InitTexturing(); // // Creating a texture // int textureId = TexUtil.CreateRGBTexture(2, 2, new byte[] { 255,0,0, // Red 0,255,0, // Green 0,0,255, // Blue 255,255,255 // White }); TextureFont texFont = new TextureFont(textureId); // Draw 10% high text at x,y=50%,50% (center of screen) upside-down (180 degrees rotated) double height = 10; double xpercent = 50; double ypercent = 50; double rotation = 0; GL.Color3(Color.Red); texFont.WriteString("Test"); texFont.WriteStringAt("Hello", height, xpercent, ypercent, rotation); }


Comments
#1
Which one is suggested to use WriteStringAt() or TextPrinter(), in order to print text on viewer? I tried both, but no luck yet. Any help will be surely appreciated.