Results 1 to 4 of 4

Thread: How to write text in an OpenGL ES game?

  1. #1

    How to write text in an OpenGL ES game?

    I want to have an instructions page in my OpenGL ES game. One approach is to combine 2d and 3d rendering and use eglSwapBuffers.

    I read about this on this forum and it seems messy, so maybe it is better to write all the instructions on a texture, which I then put on a rectangle which is shown directly in front of the camera? This approach would avoid any mixed rendering.

    If it is better to combine 2d and 3d rendering and use eglSwapBuffers, has anyone an example on how to implement this?

  2. #2
    Senior Member
    Join Date
    May 2008
    Posts
    104

    Re: How to write text in an OpenGL ES game?

    Mixed rendering is common in these kind of cases, often a UI/text might be rendered with some other API (e.g. openvg etc..), as scalar graphics and the API might be better suited for rendering a better looking UI. Then both UI and GL game elements are composited to get final displayed results . If you have a limited UI with a simple layout, then textures are good a option for display it. But keep in mind, you'll either want to display a pre-render image which won't change, or you can render to a texture with frame buffer objects for more flexibility.

  3. #3

    Re: How to write text in an OpenGL ES game?

    I read about more about combining 2d and 3d rendering. It seems messy and I only want to have an instructions page, so maybe it is better to write all the instructions on a texture, which I then put on a rectangle which is shown directly in front of the camera? This approach would avoid any mixed rendering.

    The instructions page won't change, but I also need a "game over" page with the results. This image will change with the results, so then I could render to a texture with frame buffer objects like you suggested. Do you have any example on how to implement this?

    Quote Originally Posted by jpilon
    Mixed rendering is common in these kind of cases, often a UI/text might be rendered with some other API (e.g. openvg etc..), as scalar graphics and the API might be better suited for rendering a better looking UI. Then both UI and GL game elements are composited to get final displayed results . If you have a limited UI with a simple layout, then textures are good a option for display it. But keep in mind, you'll either want to display a pre-render image which won't change, or you can render to a texture with frame buffer objects for more flexibility.

  4. #4
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: How to write text in an OpenGL ES game?

    Whenever performance is an issue you should avoid mixed rendering and render everything with OpenGL using predefined textures. When you need to render dynamic text, you should use a texture which contains every glyph you need and draw text as a list of triangles, with two textured triangles per character.

    However, for static screens you could simply draw a full-screen textured quad, with the texture either created once (e.g. the instructions page) or created at runtime using a different drawing API, then grabbing the resulting pixels and passing them to GL through glTexImage2D. Or maybe you don't need to use GL in those cases at all.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

Similar Threads

  1. Help....simple game based on openGL ES
    By lavendersg in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 05-29-2005, 07:25 PM
  2. Game for OpenGL ES?
    By shinwu in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 05-03-2004, 03:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •