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

Thread: Texture distortion

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    12

    Texture distortion



    What could cause that?
    Any ideas?

    This stuff happens when I use subregion from an atlas texture. (font atlas in this case)

    Tried applying offsets, like I did for DirectX9.0c before (where I was mapping texels to pixels), however this strategy doesn't seem to work here. =(

    Thanks.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,190
    Let's see an image of your atlas. Are you using premultipled alpha blending?

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    19
    hey, I don't know what you did in code, but you should try normalizing and unitizing your texture, i can suggest glm loader.
    From the other side, you should not use textures for your text, it will be better to use this.

    Mike

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    From the other side, you should not use textures for your text
    http://www.angelcode.com/products/bmfont/ is a good bitmap font system - particularly if you use distance fields

  5. #5
    Intern Contributor
    Join Date
    Jul 2006
    Posts
    72
    Quote Originally Posted by SoulSharer View Post
    Tried applying offsets, like I did for DirectX9.0c before (where I was mapping texels to pixels), however this strategy doesn't seem to work here. =(
    Tried? As-in, did not in original attempt? OpenGL and Direct3D different here - be sure you do it the OpenGL way (well, the default way for OpenGL).

    Just in case reference: (0,0) is where all the texture corners meet (when tiling) - _exactly_between_ the corner texels themselves. Ie, per dimension:

    texel_center_texcoord = (texel_nr + 0.5) * (1 / texture_size)

    The same is true for screen coords (in normalized device coordinates, [-1,1], (0,0) is the bottom left corner of the bottom left pixel) - be sure it is also correct in regards of your texture sampling.

  6. #6
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    12
    Thanks everyone, I've managed to handle the problem before post was approved by moderator. I was converting to premultiplied alpha with a typo in code, found out when looked up texture stored on device (with debugger).

Posting Permissions

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