james_lohr's picture

Font Colour Bug

I've identified a bug with the printer: If you print two identical strings, but of different colours, they will all be printed in the same colour as that of the first string to be printed. For example, if you copy a few lines in the QuickStart example program like so:

            printer.Begin();
 
            printer.Print(((int)(1 / e.Time)).ToString("F0"), sans_serif, Color.SpringGreen);
 
            GL.Translate(0f, 50f, 0f);
            printer.Print(((int)(1 / e.Time)).ToString("F0"), sans_serif, Color.Blue);
 
            GL.Translate(0f, 50f, 0f);
            printer.Print(((int)(1 / e.Time)).ToString("F0"), sans_serif, Color.Yellow);
 
            printer.End();

All three numbers will be printed in SpringGreen.

I suspect that the cause of this bug is that you've got some optimisation code which checks for indentical strings, but doesn't account for different colours.

Attempts to get around this have resulted in some really wierd access violation errors.

Any help would be greatly appreciated,

Many thanks,

James


Comments

Comment viewing options

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

I was able to fix the problem for myself just by moving one line in GL1TextOutputProvider and then rebuilding the Utilities dll. The problem was exactly as I thought: the cached CallList currently sets the colour internally. All I've done is moved the SetColor() call outside the CallList, so it gets called before the printer chooses to run a cached CallList or generate a new one.

If someone else has this problem, and, like myself, you're too impatient to wait for it to get fixed officially, then here's a dummy's guide to patching it yourself:

In the distribution, browse to source\Utilities and open the MVC solution file.
From the solution explorer, open GL1TextOutputProvider.cs (located in Graphics\Text).
On line 169, cut the text "SetColor(color);"
Paste this on line 90.
Rebuild the solution: you may have to remove and add the OpenTK dll reference from the project if the link was broken
The fixed OpenTK.Utilities.dll is located in root\Binaries\Release\Libraries where root is the unzipped distribution folder.

the Fiddler's picture

Thanks, this is a known bug that should be fixed in the latest round of releases. Can you please upgrade to 0.9.8-2 or 0.9.9-1 and check whether this bug still occurs?

james_lohr's picture

Thanks, it's working as expected in 0.9.9-1.