looking for FTGL
  • Caterpillar
    Caterpillar
    AmiDARK
    Posts: 38 from 2011/10/29
    From: South France
    Hello.

    I need the FTGL for a project but, cannot find it.

    I tried to DL the sources of the library 2.1.3rc5 ... impossible to compile them for MorphOS (nor for anything else).

    I'm really not familiar with MAKEFILE syntax and understand really few in what is in this file.

    Can someone help me ?

    Kindest Regards,
    AmiDARK
  • »13.09.12 - 09:54
    Profile Visit Website
  • MorphOS Developer
    Piru
    Posts: 587 from 2003/2/24
    From: finland, the l...
    https://sites.google.com/site/michaelsafyan/software-engineering/how-to-write-a-makefile

    and of course:
    http://www.gnu.org/software/make/manual/make.html#toc_Introduction

    I find it curious that you're actually programming a complex project without makefile knowledge.

    [ Edited by Piru 13.09.2012 - 14:22 ]
  • »13.09.12 - 12:07
    Profile
  • Caterpillar
    Caterpillar
    AmiDARK
    Posts: 38 from 2011/10/29
    From: South France
    I did not have to concentrate on MAKEFILE
    I just learned what was needed for my project ... and prefered concentrate on what is "important" .. the project itself !!!

    But what I found sad is that on some other Amiga related website, peoples said "I have made a port of FTGL for various project I ported to Amiga" ... but no one was able to give the needed file ... :(


    Thank you for your link ...
    I will investigate ... if it does not make me lost too much time for something I'll probably use once in my life ...

    Regards,
    AmiDARK
  • »13.09.12 - 14:02
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    BalrogSoft
    Posts: 171 from 2006/10/6
    From: Spain
    I know that you need FTGL, but freetype2 library is available on aminet:

    http://aminet.net/package/dev/gg/libfreetype2-morphos

    You can use this library and draw a font charset to a OpenGL texture, it's relatively easy. I made a small tool that export a tft font to a png texture and a xml file with all chars parameters, later this files was used on the game i was developing for iPhone and MorphOS (but it was delayed because i need to make other projects, i need to pay my bills), anyway this is a small section of code from my tool, maybe it helps you.

    Code:

    int error = FT_Init_FreeType(&library);

    if (error) {
    printf("Error: Can't initialize freetype library.n");
    return 0;
    }

    FT_Face face;

    error= FT_New_Face(library, font_name, 0, &face);

    if (error) {
    printf("Error: Can't create font face.n");
    return 0;
    }

    FT_Set_Pixel_Sizes(face, font_size, 0);

    int xf = 0, yf = font_size, max_size = 0;
    TiXmlDocument doc;


    TiXmlElement *font_element = new TiXmlElement("font");
    font_element->SetAttribute("name", font_name);
    font_element->SetAttribute("size", font_size);
    font_element->SetAttribute("texture", file_output);

    for (int c = 32; c < 256; c++)
    {

    size_t char_index = FT_Get_Char_Index(face,c);

    error = FT_Load_Glyph(face, char_index, FT_LOAD_DEFAULT);
    if (error)
    continue;

    error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);
    if (error)
    continue;

    if (xf+face->glyph->bitmap.width > output_image->width)
    {
    xf = 0;
    yf += max_size;
    if (yf + max_size > output_image->height)
    {
    printf("Error: Output texture is very small to put all characters in one texture.n");
    return 0;
    }
    max_size = 0;
    }

    TiXmlElement *element = new TiXmlElement("character");

    element->SetAttribute("code", c);
    element->SetAttribute("offsetx", xf);
    element->SetAttribute("offsety", yf-font_size);
    element->SetAttribute("width", face->glyph->bitmap.width);
    element->SetAttribute("height", font_size-face->glyph->bitmap_top+face->glyph->bitmap.rows);
    element->SetAttribute("advance", face->glyph->linearHoriAdvance>>16);
    element->SetAttribute("top", face->glyph->bitmap_top);
    font_element->LinkEndChild(element);

    if (max_size < font_size-face->glyph->bitmap_top+face->glyph->bitmap.rows) {
    max_size = font_size-face->glyph->bitmap_top+face->glyph->bitmap.rows;
    }

    for (int y = 0; y < face->glyph->bitmap.rows; y++)
    {
    for (int x = 0; x < face->glyph->bitmap.width; x++)
    {
    int ptr = (xf+x+((output_image->height-yf-y+face->glyph->bitmap_top-1)*output_image->width))*4;
    output_image->data[ptr] = face->glyph->bitmap.buffer[(x + (y * face->glyph->bitmap.width))];
    output_image->data[ptr + 1] = face->glyph->bitmap.buffer[(x + (y * face->glyph->bitmap.width))];
    output_image->data[ptr + 2] = face->glyph->bitmap.buffer[(x + (y * face->glyph->bitmap.width))];
    output_image->data[ptr + 3] = face->glyph->bitmap.buffer[(x + (y * face->glyph->bitmap.width))];
    }
    }

    xf += face->glyph->bitmap.width+1;
    }
    doc.LinkEndChild(font_element);
    doc.SaveFile("font_def.xml");
    }

    save_png(file_output, output_image);
    Balrog Software - AmigaSkool.net
    Mac Mini - MorphOS 3.8 - G4 1.5Ghz - Ati 9200 64 Mb
    Efika - MorphOS 3.6 - Ati 9200 64Mb - 80 Gb HD
    Amiga 1200D - OS 3.9 - Blizzard 603e/240mh
  • »14.09.12 - 12:36
    Profile Visit Website
  • Caterpillar
    Caterpillar
    AmiDARK
    Posts: 38 from 2011/10/29
    From: South France
    Balrog Soft,

    I already uses FTGL in the project ... I will not rewrite all to use FreeType instead of FTGL.
    Don't want to lost time doing this task (and not having much time to do this)..

    I managed to run the configure under MorphOS for FTGL.
    It ran ok under sh.
    But it telled me that it requires freetype2 library...
    I've installed it in the SDK ... Same result ..
    Someone know what's wrong ?

    Thank you.
  • »19.09.12 - 07:42
    Profile Visit Website
  • MorphOS Developer
    stefkos
    Posts: 96 from 2004/2/4
    Please e-mail me. I just compiled last version of FTGL.
    I'm not sure if its working beacouse lack of 3d on pb:)
  • »19.09.12 - 17:09
    Profile Visit Website
  • Caterpillar
    Caterpillar
    AmiDARK
    Posts: 38 from 2011/10/29
    From: South France
    Sent a PM with my e-mail in ... cos I don't have your e-mail.

    Stekkos,
    Thank you, everything compiles like it should.
    Demo run perfectly :)
    Theorically your FTGL lib seem ok.

    Thank you for your help.

    Regards,
    AmiDARK

    [ Edité par AmiDARK 21.09.2012 - 07:45 ]
  • »20.09.12 - 13:24
    Profile Visit Website