PDA

View Full Version : Writing text field with OpenGL.



itzike
07-02-2002, 07:51 AM
Hi.

I have to implement a text field, including writing into it in variant fonts, how can I do it with OpenGL?
** It must support Windows, Linux, and Mac.

Thanks Itzik.

jwatte
07-02-2002, 07:11 PM
The native font systems of Win32 and MacOS are far beyond those of OpenGL, and X has some font capabilities too. Thus, I'd suggest you render into an offscreen buffer using each native API on each platform, and then upload as a texture for display.

Implementing the same application-level interface using different code for different platforms is very common in portable programs.

If you want a solution that doesn't use any native facilities, look into the FreeType library; let that render into an offscreen bitmap and upload as texture. However, that way, the user won't necessarily get the same set of fonts as (s)he is used to on their machine.

itzike
07-02-2002, 10:02 PM
Do you know about any code sample implement the solution you suggested?

Thanks.


Originally posted by jwatte:
The native font systems of Win32 and MacOS are far beyond those of OpenGL, and X has some font capabilities too. Thus, I'd suggest you render into an offscreen buffer using each native API on each platform, and then upload as a texture for display.

Implementing the same application-level interface using different code for different platforms is very common in portable programs.

If you want a solution that doesn't use any native facilities, look into the FreeType library; let that render into an offscreen bitmap and upload as texture. However, that way, the user won't necessarily get the same set of fonts as (s)he is used to on their machine.