Page 1 of 1

Fast wxFont rendering on a wxGLCanvas

Posted: Mon Jul 18, 2005 10:27 pm
by Jengu
I'm trying to figure out a quick way to render text using wxFonts on a wxGLCanvas. This is proving to be sort of hard.

First, I draw the text to a wxMemoryDC. Then I convert the wxMemoryDC to a wxBitmap. Then I convert the wxBitmap to a wxImage. THEN I use wxImage::GetData() to make an OpenGL texture.

This is really inefficient and slow. Is there a faster way? The only thing I can think of is using a separate library for font rendering (one of the many OpenGL wrappers around freetype).

Re: Fast wxFont rendering on a wxGLCanvas

Posted: Thu Jul 21, 2005 11:41 pm
by Ryan Norton
Jengu wrote:I'm trying to figure out a quick way to render text using wxFonts on a wxGLCanvas. This is proving to be sort of hard.

First, I draw the text to a wxMemoryDC. Then I convert the wxMemoryDC to a wxBitmap. Then I convert the wxBitmap to a wxImage. THEN I use wxImage::GetData() to make an OpenGL texture.

This is really inefficient and slow. Is there a faster way? The only thing I can think of is using a separate library for font rendering (one of the many OpenGL wrappers around freetype).
wxGLCanvas is a pretty light wrapper... for fonts you'll have to get down to platform-specific gl calls like the windows version at
http://msdn.microsoft.com/library/defau ... o_1h6f.asp

Posted: Fri Jul 22, 2005 10:32 am
by geon
White your own print function. I reccoment you put your font in a pre-rendered texture and render each character as a quad.