Results 1 to 2 of 2

Thread: Text on Image

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    1

    Text on Image

    Hi all,

    Given I'm very new to OpenVG, and I have had no luck finding documentation or samples that give me pointers, I decided I should try his place.

    My problem is divided into two issues:

    1) Draw text
    2) Draw that text on an Open VG Image.

    For #1 I'm not finding anything that fully shows how to render text. I have seen a lot of talk of the glyphs, fonts and what not, but no code sample that show all steps required to paint a string at a certain position with a certain formatting.

    For #2 I have read on the OpenVG 1.1 Specifications that you can target an image for your painting, but I'm not able to understand how this is done, and I can't find a sample where you paint on an image and then paint that "edited" image onto the screen.

    What I'm trying to achieve is writing text onto an image and then display that image.

    Thanks.

  2. #2
    Senior Member
    Join Date
    Feb 2006
    Posts
    115

    Re: Text on Image

    1)
    - Get Freetype. Use it to read ttf files.
    - make OpenVG path data out of that with Hybrid's old font2openvg.cpp code (or write your own). This will generate the glyph data in a format you can use (it will make a .c or .h file you can include in whatever project you need it in).

    - Then, in the program you're rendering in, create the font object and populate the glyphs with the path data. Then it's just a matter of calling the vg funtions to render text.

    See http://www.khronos.org/message_board...t=1385&start=0 for details and some source. The font section in the VG spec is fairly well written though - it's doesn't require cross referencing every other word.

    2)
    If you're using EGL, then you can use eglCreatePbufferFromClientBuffer(). Just use eglMakeCurrent() to switch to the pbuffer, and after you switch back the image will be populated. (Caution: you might want to use eglMakeCurrent() with NULL to disconnect from the current context before making a new one current).

    If eglCreatePbufferFromClientBuffer() is not available, use any off-screen surface (or, if the screen is double buffered, and trashing the contents of the frame buffer is not an issue, just use the normal window surface), and use vgGetPixels()/vgReadPixels() to transfer it into your image.

    The text bit is the same as in part #1.

Similar Threads

  1. About Text rendering
    By mylogic in forum OpenVG and VGU
    Replies: 9
    Last Post: 02-27-2012, 11:47 AM
  2. Text on Vincent
    By Eymerich in forum OpenGL ES general technical discussions
    Replies: 15
    Last Post: 08-09-2008, 06:34 PM

Posting Permissions

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