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 5 of 5

Thread: Bad 2D glyphs rendering using point sprites

  1. #1
    Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Spain
    Posts
    269

    Bad 2D glyphs rendering using point sprites

    Hello,

    I have a problem with textured point sprites. In my current application, I use extensively 2D 9x9 markers over photographs. Well, I though that the best way to render them could be using textured point sprites. This means only send one vertex per marker and let GL compute correct texture coordinates. Then I placed an ortho2d view and translated it by 0.375 in horz. and vert. (as MSDN and GL FAQ says, to ensure an exact match between texels and pixels, but this dont work as expected. Sometimes makers apperas shrinked in one dimension or stretched, like if texcoords were displaced a bit. Here is an example of a good and a bad marker:


    Marker #470 is perfectly drawn, but #311 don't.
    This effect happens randomly, when I pan or zoom my scene, and not all markers are affected, only few.
    This looks like a floating point round error, but I ran out of ideas.

    I disabled in NV control panel anisotropic filtering and antialising, but it had no effect.

    P.D: my graphic card is an NV 8500 GT with driver version 158.22 (later I'll try with newest drivers, but this issue is happening since some driver versions and I really dont thing that could be a driver issue, but I'll it)

    P.D: for drawing I'm using the simplest fragment shader ever:
    uniform sampler2D texture;
    void main()
    {
    gl_FragColor = texture2D(texture, gl_TexCoord[0].xy) * gl_Color;
    }

    and in the VS, texcoords are simply passed to the FS:
    gl_TexCoord[0] = gl_MultiTexCoord0;
    as well as point size:
    gl_PointSize = gl_Point.size;


    If anyone is experienced with 2d glyphs drawing using point sprites, I really apreciatte his advises

    Jacobo.
    "I don't know... with a casual fly"

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: Bad 2D glyphs rendering using point sprites

    Translate by 0.5.

    Points need to be drawn on exact pixel centers.

  3. #3
    Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Spain
    Posts
    269

    Re: Bad 2D glyphs rendering using point sprites

    I already tried that, but didn't solved the problem
    "I don't know... with a casual fly"

  4. #4
    Member Regular Contributor
    Join Date
    Mar 2005
    Posts
    302

    Re: Bad 2D glyphs rendering using point sprites

    Just to verify - what if you submit them as quads (or even tri's), do they still render bad? (for your case, it seems performance issue isn't in the ns range for this :-) )

  5. #5
    Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Spain
    Posts
    269

    Re: Bad 2D glyphs rendering using point sprites

    With quads I do not have any problem, in fact texts are drawn with quads (texcoords for text are a little tricky for point sprites) but performance matters because I'm drawing a huge number of glyphs, some projects can show around 7000 glyphs or more, depending on project settings number of options to show, number of displayed photos, etc
    "I don't know... with a casual fly"

Posting Permissions

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