Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: FTGLPolygonFont Smooth Rendering Problem

  1. #1
    Intern Newbie
    Join Date
    Jun 2006
    Posts
    31

    FTGLPolygonFont Smooth Rendering Problem

    I'm simply trying to get an FTGLPolygonFont to render smoothly. When glEnable(GL_POLYGON_SMOOTH), the triangle tessellation lines appear gray. Why is it doing this. This is a 2D application. What do I do???

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    999

    Re: FTGLPolygonFont Smooth Rendering Problem

    You have to be careful when using polygon smoothing. It's only well defined for a subset of all possible polygons.

    Multisample antialiasing is most valuable for rendering polygons, because it requires no sorting for hidden surface elimination, and it correctly handles adjacent polygons, object silhouettes, and even intersecting polygons. If only points or
    lines are being rendered, the “smooth” antialiasing mechanism provided by the base GL may result in a higher quality image. This mechanism is designed to allow multisample and smooth antialiasing techniques to be alternated during the
    rendering of a single scene.
    So unless you're anti-aliasing lines or points it's best to use multisampling rather than polygon smoothing.

  3. #3
    Intern Newbie
    Join Date
    Jun 2006
    Posts
    31

    Re: FTGLPolygonFont Smooth Rendering Problem

    I just modified FTGL to make it do what I want:

    I rewrote the following function

    FTPolyGlyph::FTPolyGlyph( FT_GlyphSlot glyph, bool useDisplayList)
    : FTGlyph( glyph),
    glList(0)
    {
    if( ft_glyph_format_outline != glyph->format)
    {
    err = 0x14; // Invalid_Outline
    return;
    }

    FTVectoriser vectoriser( glyph);

    if(( vectoriser.ContourCount() < 1) || ( vectoriser.PointCount() < 3))
    {
    return;
    }

    unsigned int horizontalTextureScale = glyph->face->size->metrics.x_ppem * 64;
    unsigned int verticalTextureScale = glyph->face->size->metrics.y_ppem * 64;

    vectoriser.MakeMesh( 1.0);

    if( useDisplayList)
    {
    glList = glGenLists( 1);
    glNewList( glList, GL_COMPILE);
    }

    const FTMesh* mesh = vectoriser.GetMesh();
    for( unsigned int index = 0; index < mesh->TesselationCount(); ++index)
    {
    const FTTesselation* subMesh = mesh->Tesselation( index);
    unsigned int polygonType = subMesh->PolygonType();

    glBegin( polygonType);
    for( unsigned int pointIndex = 0; pointIndex < subMesh->PointCount(); ++pointIndex)
    {
    FTPoint point = subMesh->Point(pointIndex);

    glTexCoord2f( point.X() / horizontalTextureScale,
    point.Y() / verticalTextureScale);

    glVertex3f( point.X() / 64.0f,
    point.Y() / 64.0f,
    0.0f);
    }
    glEnd();
    }



    glEnable(GL_LINE_SMOOTH);
    glBegin( GL_LINE_LOOP);

    size_t numContours = vectoriser.ContourCount();
    for( unsigned int c = 0; c < numContours; ++c)
    {
    const FTContour* contour = vectoriser.Contour(c);

    glBegin( GL_LINE_LOOP);
    for( unsigned int pointIndex = 0; pointIndex < contour->PointCount(); ++pointIndex)
    {
    FTPoint point = contour->Point(pointIndex);
    glVertex2f( point.X() / 64.0f, point.Y() / 64.0f);
    }
    glEnd();
    }

    glDisable(GL_LINE_SMOOTH);

    if(useDisplayList)
    {
    glEndList();
    }
    }

  4. #4
    Intern Newbie
    Join Date
    Jun 2006
    Posts
    31

    Re: FTGLPolygonFont Smooth Rendering Problem

    By the way,

    glEnable(GL_LINE_SMOOTH);
    glBegin( GL_LINE_LOOP);

    size_t numContours = vectoriser.ContourCount();
    for( unsigned int c = 0; c < numContours; ++c)
    {
    const FTContour* contour = vectoriser.Contour(c);

    glBegin( GL_LINE_LOOP);
    for( unsigned int pointIndex = 0; pointIndex < contour->PointCount(); ++pointIndex)
    {
    FTPoint point = contour->Point(pointIndex);
    glVertex2f( point.X() / 64.0f, point.Y() / 64.0f);
    }
    glEnd();
    }

    glDisable(GL_LINE_SMOOTH);

    is my addition

Posting Permissions

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