PDA

View Full Version : wglUseFontOutlines bug !



dukey
12-08-2009, 10:12 AM
Trying to help someone port an application from win32 -> OGL

But we have a big problem with the font rendering. When the nEscapement member of CreateFont http://msdn.microsoft.com/en-us/library/dd183499%28VS.85%29.aspx is set. The font becomes titled the right way, only the line of text goes off at the wrong angle. I compared normal win32 rendering with the outline font and it's definitely a bug.

wglUseFontBitmaps is also broken when the nEscapement member is set, although in a different way.

http://img260.imageshack.us/img260/2907/fontfail.png

sammie381
12-08-2009, 12:04 PM
I don't think it's wrong. GDI and OpenGL can have different coordinate systems. For GDI, x+ goes right, y+ goes down.
OpenGL goes to whatever your viewing matrix is set, like x+ right, y+ up. You probably just have to negate y or something.
So, if something is turning the wrong way, negate the angle too.

dukey
12-08-2009, 05:38 PM
I tried negating the angle, the problem just happens in reverse then. The angle the text goes and the angle of the individual characters are opposite ! This is totally unlike the win32 version. I've tried swapping the up/down on the projection matrix to convert from win32->ogl coordinates, but then the text just renders upside down. This is definitely a bug.

sammie381
12-08-2009, 06:10 PM
I tried negating the angle, the problem just happens in reverse then. The angle the text goes and the angle of the individual characters are opposite ! This is totally unlike the win32 version. I've tried swapping the up/down on the projection matrix to convert from win32->ogl coordinates, but then the text just renders upside down. This is definitely a bug.

The MSDN docs say you need to set nEscapement and nOrientation to the same value.

dukey
12-09-2009, 06:25 AM
nOrientation has no effect at all.

sammie381
12-09-2009, 09:07 AM
nOrientation has no effect at all.

wglUseFontOutlines does ignore some CreateFont parameters.
Perhaps OpenGL can only render font characters them separately? It creates the characters in a display list format.
If so, would probably have to do your own rotation transformations then, using glRotatef().

dukey
12-09-2009, 09:38 AM
When you set nEscapement it is meant to set both nEscapement and nOrientation. It correctly rotates the characters, but the text seems to get the inverse rotation which is bizare. How can we get Microsoft to fix this ?

sammie381
12-09-2009, 11:38 AM
When you set nEscapement it is meant to set both nEscapement and nOrientation. It correctly rotates the characters, but the text seems to get the inverse rotation which is bizare. How can we get Microsoft to fix this ?

Sure, but I think it's applying the rotation separately to each character, but not to the entire string.
Remember, these are pre-compiled display lists. The list is created once. All characters are treated the same,
created alphabetically in order. How would OpenGL know which character is tranformed first in the display list?
Or second? It can't. The transformation is left up to you.