Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Antialiasing fonts...

  1. #1

    Antialiasing fonts...

    Hi all,
    i have a bit of a silly question..
    I want to use window fonts in my opengl app, but not when it looks all pixelated, is there a way to Antialias the fonts?

    thanx
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  2. #2

    Antialiasing fonts...

    can't you just use trilinear filtering to blur the outline a bit up?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #3

    Antialiasing fonts...

    Im not sure if i can, as far as i know you use the trilinear filter on a texture, but the fonts are generated from a windows font file.

    [pascal]
    fontIndex := glGenLists(96);

    Font := CreateFont(18, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET,
    OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE or DEFAULT_PITCH, PChar('Arial Narrow'));
    SelectObject(hDC, Font);
    wglUseFontBitmaps(hDC, 0, 256, fontIndex);
    [/pascal]

    I dont know if there is any way to gain access to the bitmaps/data, or what i can do, i looked at an antialiasing extension, but neither of my computers support it :s

    if using trilinear on a font is possible, how do i go about doing it?
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  4. #4

    Antialiasing fonts...

    Personally I wouldn't use wglUseFontBitmaps() if you want any sort of decent quality out of the fonts.

    I use AngelCode's Bitmap Font Generator ( http://www.angelcode.com/products/bmfont/ ) and then have some code that takes that texture and draws the text string on screen for me. You then get results like this (an unfinished Dogfight comp entry )
    http://users.on.net/~sly/images/bfauto3.jpg

  5. #5

    Antialiasing fonts...

    Thanx Sly,

    I already i have wrote my own font generator and renderer, but i cant see any point of creating several fonts for this if i can use the systems fonts, my application will have support for themes and will have text based applications (eg notepad, etc) and with these i would like to support custom fonts (eg Arial narrow for one, and times new roman for another) and i dont really want to generate 100's if not 1,000's of fonts for this and then have to ship them with every theme if i dont have to.

    (been drinking so i hope this makes some sense :roll..

    If its not possible then i will probably do a hybrid (a bit of both)
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  6. #6

    Antialiasing fonts...

    Use the best of both. Generate the font texture at the time it is needed. You have the code for the texture generator, and you want to use the fonts available on their system. At runtime, when a font is required, generate the font bitmap using your code to a temporary texture, then load that texture and use it in your font rendering code.

  7. #7

    Antialiasing fonts...

    Thats an idea, i will try that soon.. thanx..

    On another point, im am using GL_POINT_SMOOTH to smoothen my terrain and i will be using to smoothen my worlds but i have an issue im concerned about.

    When i use it it blends with the background, which at first i decided to render the terrain a second time one at: 0, -0.5, 0 and the second at 0, 0, 0, this works ok and does smoothen most of it but of course this doubles the amount vertices to be rendered and when i finished this i will end up having cities (like what you see in GTA 3 and 4) and this wont be a very good approach unless every one has a top range gfx card.. is there a better way around this?

    heres some shots to see what i mean:
    Without rendering the terrain twice:
    [Removed]

    With rendering the terrain twice:
    [Removed]

    Thanx
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  8. #8

    Antialiasing fonts...

    I'm not sure I understand what your question or problem is. Yes, rendering the entire terrain twice is not a good thing for any application.

  9. #9

    Antialiasing fonts...

    lol sorry,

    Basiclly i am using an OpenGL routine that smoothens all lines, points and polygons that are rendered and it does this by antialiasing the edges, how ever it does this for every triangle that is drawn in the terrain, this is shown in my first image, but i have solved this problem by rendering the terrain twice once with out the smooth attribute and the second with it (shown in the second image), but this of course will become a bigger problem when i come to rendering the whole city instead of just the terrain, and i am just woundering if there is a better way of doing this without using a shader or new extensions?

    the gl functions im using are:
    [pascal]
    glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);

    glEnable(GL_POINT_SMOOTH);
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_POLYGON_SMOOTH);
    [/pascal]

    The Line and Polygon ones arent a problem at the moment because the line one only effects it when i use glPolygonMode(GL_FRONT_AND_BACK, GL_LINE), and i dont really use the polygon one for the terrain..
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  10. #10

    Antialiasing fonts...

    I do not know much about smoothing in OpenGL. I've got as far as drawing a few triangles and a font. Ok, maybe a bit more than that, but not much.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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