chandragon's picture

How to render text on the screen

I feel a bit of shame asking such a basic thing, but how do I render text on the screen ?
I searched for classes that could do that and found on internet that many people use a "TextPrinter" instance, but I don't find that class in OpenTK.Graphics.
I read in a post of this forum that it would be in "OpenTK.Compatibility", but I don't have it, has it been removed from the newer versions of OpenTK ? is there any substitute for the TextPrinter ?
Thanks for the answers !


Comment viewing options

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

The example works normally, but I tried to create a new project with 1.1.2 with just MyTextWriter using the debug mode. I'm still getting an error, but a different one.. MyTextWriter.Draw() is throwing a StackUnderFlow exception on the last line (GL.PopMatrix();) I tried stepping through the code to see if the error was beforehand but no luck.

(my original project threw an InvalidValue exception in MyTextWriter.UpdateText() and failed there, I should have said it was an exception from the ErrorHelper.)

the Fiddler's picture

Double check that your GL.PushMatrix and GL.PopMatrix calls are balanced.

I would suggest using apitrace to capture a trace of the OpenGL calls you are issuing. This is extremely helpful when debugging OpenGL errors: the trace will immediately show where the error is caused. You can also upload is somewhere so we can take a look.