In OpenGL, you need to write a text renderer.  There are several
examples and implementations floating around on the web.

For example, I wrote a class that, given a font and a font size,
generates an atlas texture and stores all of the individual character
locations and metrics for me.  I then use that class to draw dynamic
text everywhere in my scene.  It took me a few hours to write and
works great.  The interface looks like:

public TextRenderer(Context context, GL10 gl, GraphicsConfiguration
graphicsConfig, Typeface tf, float fontSize, int stroke, int
horizSpacing) {}
public void drawTextLine(GL10 gl, int x, int y, char[] text, int
length) {}

I recommend doing something like that.

There are other ways, of course.  You can load in the geometry from a
true-type font and render that, though I don't know how easy it will
be in ES to handle the curves and lack of polygon mode.

On Apr 12, 9:49 am, "A.TNG" <tang.j...@gmail.com> wrote:
> On Mon, Apr 12, 2010 at 10:39 PM, Renjith <renjithkum...@gmail.com> wrote:
> > Hi,
>
> > Can anyone help me to understand how to draw text on GLSurfaceView in
> > Android ?
>
> > Thanks in advance
> > Ren
>
> You cannot draw text on glsurface. What you can do is draw text on a
> bitmap, then bind this bitmap as texture to glsurface, user
> drawElement to show this bitmap.
>
> You could check ApiDemo to learn how to draw bitmap on glsurface. Good luck.
>
> --
> Best Regards,
> TANG Jiyu
> Blog:http://jiyu.wordpress.com.cn/
> ezkeypad:http://ezkeypad.tool100.com/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to