On 01/10/2014 10:56 AM, terco IDE wrote:
> Hi, does anyone has an example on rendering some text in a glArea with (or 
> without) openGL?
>
> tnx!
>
> Saludos
> Martin

Yes (using OpenGL), but it's rather involved. I had an epic failure of 
hardware and human logic this week and am just wrapping up restoring 
sanity to my server and workstation, but give me a day or so and I'll 
give you the source code.

It's my understanding that OpenGL has no native support of rendering 
text, that it must be done manually. I can also provide you with a 
couple of "fonts" that I created from ttf.

Basically you take a ttf, type out all the characters you want in GIMP 
(I recommend keeping them in line with an ASCII table), then save each 
character into a separate png file with alpha. You then load these into 
OpenGL textures and render them as quads. The horrible bit (as if it 
weren't horrible enough) is getting the spacing right for different 
combinations of characters. You'll want to add drop shadows, beveling, 
etc. in GIMP as I don't know of a way to do this in OpenGL other than 
perhaps by using shaders (zero knowledge there).

Using Gambas's native software text rendering libraries is slower but 
easier.

Kevin

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to