nicolas's picture

TextPrinter problem

private readonly TextPrinter printer = new TextPrinter(TextQuality.Default);
private readonly Font font = new Font("Verdana", 10);
GL.Translate(300F, 270F, 0F);
printer.Print("TEST", font, Color.White);

this works fine on my development pc running vista (intel duo cpu 3ghz, 2gb ram) but not on my test pc running xp (via nehemiah cpu 666 mhz, 240 mb ram). this test pc is actually a touchscreen terminal. on this terminal I see a bunch of dots and lines, seemingly the top pixel line of "TEST" but I'm not sure. the video adapter on the terminal is "S3 graphics twister".

is this a performance issue? is my test pc too weak to run textprinter?


Comment viewing options

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

My guess is that this is a driver issue. The driver either fails to upload the texture correctly (doesn't respect the specified PixelStore state) or doesn't support alpha textures.

Which OpenGL version does this card support? Is it 1.1 or 1.2? (The 1.2 codepath uses full rgba textures, which tend to be more stable on old cards).

Is it possible to run OpenTK Examples.exe on the test PC? More specifically, try running the "Textures" and "Fonts" examples to see if they render correctly.

The fact is that S3 is notorious for its bad drivers. It is probably possible to get this to work, but you can expect different issues to crop up later. I doubt you'll find anything, but try searching for updated drivers (you never know).

nicolas's picture

thanks for the swift reply

the "textures" sample runs fine but the "fonts" sample renders a bunch of stripes, like morse code almost. we tried searching for updated drivers but the last one was from 2003 and it produced the same result. I think I'll work around the issue by generating bmp files in .net and mapping those as a texture.

the Fiddler's picture

This is the best solution, actually, as long as you don't mind losing unicode support.

One more test would be great, to help pinpoint the exact cause of the corruption: can you please compile and run the attached file? If PixelStore works fine, it will display exactly the top-left quarter of the source image.

logo.jpg28.29 KB
test.cs4.61 KB
nicolas's picture

yeah that works fine on the terminal

the Fiddler's picture

It's a problem with alpha textures then. If the card supports OpenGL 1.2, changing TextQuality.Default to TextQuality.High should fix the problem. Otherwise, please post the vendor and renderer strings (obtained via GL.GetString, or through Examples.exe -> Extensions) so I can add a workaround for this card.

nicolas's picture

nope still dots and stripes instead of text

Vendor: S3 Graphics, Incorporated
Renderer: ProSavage/Twister
Version: 1.1 2.40.116
Support: 752 of 1855 functions supported

the Fiddler's picture

Ok, the card doesn't support OpenGL 1.2 and TextPrinter is falling back to TextQuality.Medium (which uses alpha textures). I will add a workaround for this card to always use RGBA textures, which should fix the issue.

the Fiddler's picture

Ok, committed a workaround to rev. 1738. Can you please do a SVN checkout and test if it works?

nicolas's picture

I did a checkout but I can't find the OpenTK.sln file

edit: got it, ran the build.exe file

nicolas's picture

I get a stack overflow error:

************** Exception Text **************
OpenTK.Graphics.OpenGLErrorException: StackOverflow
at OpenTK.Graphics.GraphicsContext.CheckErrors()
at OpenTK.Graphics.ErrorHelper.Dispose()
at OpenTK.Graphics.GL.PushMatrix()
at OpenTK.Graphics.Text.GL1TextOutputProvider.Begin()
at OpenTK.Graphics.TextPrinter.Begin()

only on the terminal though, on my own pc it still works