GerhardKauer's picture


Hi there,

we are using the OpenTK for our scientific work here in our bioinformatics department of the univeristy of applied sciences in Emden. First of all: THANKS for programming OpenTK. It is perfectly usable and STABLE for our efforts in scientific image annotations and visualization of data.

What we use for displaying text on images is the TextPrinter (which seems to be "outdated"). We tried some alternatives, but the "good old" textprinter is a work-horse which just does what we need to do perfectly.

Could you provide us with the source code of the "old, outdated" TextPrinter class so that we could maintain it, if needed?

Good luck and happy programming !

Best regards,

Prof. Dr. Gerhard Kauer


Comment viewing options

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

You can find the source in OpenTK.sln -> OpenTK.Compatibility/Graphics. Feel free to split it out into a new project and use it / maintain it. Many people ask for the TextPrinter but it just doesn't belong into a low-level OpenGL wrapper (and I don't have the time to maintain it, anyway).

Another approach I've generally had success with is to use System.Drawing to draw text to a Bitmap and display that to screen via an OpenGL texture. OpenTK trunk has a new text rendering example that demonstrates this approach. It is suitable for static 2d overlays rather than 3d scenes (e.g. labels on a rendering) but it's much simpler than the TextPrinter and provides even better performance for the scenes it fits in.

c2woody's picture

Please keep this thread updated, maybe some ideas can be discussed here as well that relate to performant text output (using bitmap-only output for better decoupling of the text printing and text rendering modules for example).

jhllnd's picture

I have to use the Format32bppPArgb at Bitmap creation time, or i am unable to change the texture data with GL.TexSubImage2D.

bmp = new Bitmap(width, height, Imaging.PixelFormat.Format32bppPArgb);

Otherwise this will not work:

protected override void OnUpdateFrame(FrameEventArgs e)
	renderer.DrawString("Test", mono, Brushes.White, new Point(50, 200));

Is this a bug?

Edit: I am using the 1.0 version of OpenTK