Hm, I'm not sure I'm following you.  What I have in mind is

- make a new Paint, setTypeface() and setTextSize() on it
- take a string to render, measure it using getTextBounds()
- create a Canvas, setting it a Bitmap (usually a Bitmap of bounds
width*height, both taken to the next power of two if you'll want to use it
directly as a GL texture)
- draw your text to the bitmap by calling drawText() on the Canvas

Now you have a Bitmap with rendered text that you can use as any other
texture.

I don't see a need for overlaying a view on top of GLSurfaceView, or any
threading issues (unless you want to render walls of dynamic text (unlikely
for a game) the above only runs once during initialisation, on a thread of
your choice).


On Thu, Jan 31, 2013 at 6:30 PM, Nobu Games <[email protected]>wrote:

> Oh, in addition to what I said:
>
> since GL rendering and Android UI are done in two separate threads, there
> is the chance that both text and 3D graphics are not completely in sync.
> This is not much of a problem for HUDs, but it might turn out to be a
> problem when text has to be positioned alongside a moving game object.
>
>
> On Thursday, January 31, 2013 11:23:02 AM UTC-6, Nobu Games wrote:
>>
>> I haven't tested / benchmarked that myself using OpenGL ES, but what I
>> read so far over on Stackoverflow is that developers noticed a performance
>> impact when you have an extra view for rendering text on top of a
>> GLSurfaceView.
>> I only experimented with a custom view with text and graphics rendering
>> on top of a camera preview so far. And the frame rate was acceptable
>> (around 30 FPS on a Galaxy S doing nothing much fancy).
>>
>> However, I do not want to take that approach because I'm currently
>> developing a game engine that has to be portable. Therefore I'm trying to
>> abstract platform-specific details and having fonts being rendered in
>> OpenGL sounds quite portable to me :-)
>>
>>
>> On Thursday, January 31, 2013 10:58:04 AM UTC-6, latimerius wrote:
>>>
>>> On Thu, Jan 31, 2013 at 5:13 PM, Nobu Games <[email protected]>wrote:
>>>
>>>> 2. This seems to be the Android standard approach: pre-render an atlas
>>>> / map texture with all letters and symbols you need using a Bitmap, Canvas
>>>> and a font of your choice. The Android tools available are very
>>>> straightforward to use and I guess that'll be the way to go for me. The
>>>> only problem here is: you need to take care of rendering the letters with
>>>> correct spacing and line breaks etc. The letter spacing can be determined
>>>> in the map generation step, though.
>>>
>>>
>>> Why don't you just use Canvas & Paint to render the text(s) you'd like
>>> display?
>>>
>>> Locale handling can turn out a PITA but otherwise, this seems a good
>>> solution to me.  Just out of curiosity, what would you gain by doing what
>>> you describe (i.e. using the glyphs but writing you own typesetting code)?
>>>
>>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to