Draw text in OpenGL ES
The Android SDK doesn't come with any easy way to draw text on OpenGL views. Leaving you with the following options.
- Place a TextView over your SurfaceView. This is slow and bad, but the most direct approach.
- Render common strings to textures, and simply draw those textures. This is by far the simplest and fastest, but the least flexible.
- Roll-your-own text rendering code based on a sprite. Probably second best choice if 2 isn't an option. A good way to get your feet wet but note that while it seems simple (and basic features are), it get's harder and more challenging as you add more features (texture-alignment, dealing with line-breaks, variable-width fonts etc.) - if you take this route, make it as simple as you can get away with!
- Use an off-the-shelf/open-source library. There are a few around if you hunt on Google, the tricky bit is getting them integrated and running. But at least, once you do that, you'll have all the flexibility and maturity they provide.
OpenGL, Is this the best way to draw text?
that change every millisecond
First of all, that would require a display update frequency of 1000Hz to be even representable. No display in the world is that fast. The fastest displays around manage some 200Hz. So don't even think about updating your timer display at that rate.
An important rule about displays is: Don't display more digits than you can actually accurately measure. The accuracy of display updates is in the order of 1/10s of a second, so you should display only that much.
If you want to store a screenshot of a game, then the game update tick interval determines the accuracy. Usually no more than 100Hz, i.e. 1/100 of a second.
Now since you don't want to upload a new string texture every frame, the common way to go about this are glyph texture atlases, i.e. a texture with every glyph you want to render in it, from which you then draw quads addresses the respective characters by their texture coordinate. To save on texture memory you can use some method like Distance Fields (implemented for example in libGDX).
Also I recommend reading this SO answer on OpenGL text rendering methods
Related Topics
Slowing Speed of Viewpager Controller in Android
Android Studio 0.4 Duplicate Files Copied in APK Meta-Inf/License.Txt
How to Change Default Dialog Button Text Color in Android 5
Ideal Way to Set Global Uncaught Exception Handler in Android
Formula Px to Dp, Dp to Px Android
Get Contact Info from Android Contact Picker
How to Send Parameters from a Notification-Click to an Activity
How to Know an Application Is Installed from Google Play or Side-Load
How to Send Data from One Fragment to Another Fragment
Unable Instantiate Android.Gms.Maps.Mapfragment
Don't Reload Application When Orientation Changes
How to Access the Drawable Resources by Name in Android
How to Provide Shadow to Button
Convert a PDF Page into Bitmap in Android Java
Android Linearlayout:Add Border with Shadow Around a Linearlayout