objarni's picture

Help with font rendering

Am I doing something wrong here? I'm trying to follow the font example program, Fonts.cs.

[ I added push/pop and enable/disable calls just to make sure it had nothing to do with the depth buffer (which is not used in Fonts.cs), neither the GL matrix state getting destroyed by TextPrinter. Adding/removing these calls make no difference ]

The text is seen onscreen, problem is, nothing else is seen! That is, any GL_TRIANGLES or other primitives rendered, simply disappear!

TextureFont font = new TextureFont(new Font(FontFamily.GenericSansSerif, 16.0f))
TextPrinter printer = new TextPrinter();
 
      public void DrawHello()
      {
        GL.PushAttrib(AttribMask.AllAttribBits);
        GL.PushMatrix();
        GL.PushClientAttrib(ClientAttribMask.ClientAllAttribBits);
        GL.Disable(EnableCap.DepthTest);
        GL.DepthMask(false);
 
        TextHandle handle;
        printer.Prepare("Hello", font, out handle);
        printer.Begin();
        printer.Draw(handle); 
        printer.End();
        handle.Dispose();
 
        GL.DepthMask(true);
        GL.Enable(EnableCap.DepthTest);
        GL.PopClientAttrib();
        GL.PopMatrix();
        GL.PopAttrib();
      }

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

Push/Pop both, the ModelView and Projection matrices. This problem is dealt with in http://opentk.sourceforge.net/home/?q=node/96

objarni's picture

Great! Thanks Inertia..