Results 1 to 8 of 8

Thread: [SOLVED] Bad image when rotating sprites in opengl

  1. #1

    [SOLVED] Bad image when rotating sprites in opengl

    Im getting really bad graphics in certain angles



    i use the code

    Code:
      glBegin(GL_TRIANGLE_STRIP); //
      glTexCoord2f(xfrac, yfrac);
      glVertex2f(x, y);
    
      glTexCoord2f(xfrac, hfrac);
      glVertex2f(x, y + titleh);
    
      glTexCoord2f(wfrac, yfrac);
      glVertex2f(x + titlew, y);
    
      glTexCoord2f(wfrac, hfrac);
      glVertex2f(x + titlew, y + titleh);
      glEnd;
    Whats wrong?


    EDIT : You have to apply the texture filters after loading them
    From brazil (:

    Pascal pownz!

  2. #2

    [SOLVED] Bad image when rotating sprites in opengl

    Are you using linear filtering for texture quality? You can change that with commands:
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TextureQuality);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TextureQuality);
    where TextureQuality could be GL_LINEAR

  3. #3

    [SOLVED] Bad image when rotating sprites in opengl

    Thats what i use at the init :?

    Code:
      // when texture area is small, bilinear filter the closest mipmap
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
      // when texture area is large, bilinear filter the original
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    From brazil (:

    Pascal pownz!

  4. #4

    [SOLVED] Bad image when rotating sprites in opengl

    help
    From brazil (:

    Pascal pownz!

  5. #5

    [SOLVED] Bad image when rotating sprites in opengl

    Hmm.. i'm still not convinced

    At the init you say? It needs to be called individually when each texture is loaded somewhere after glBindTexture.

    It is easy to spot if linear filter is on when scaling graphics. For the smoothing issue, linear should be responsible for the inner contains of texture but further antialiasing can smoothen the borders.

  6. #6

    [SOLVED] Bad image when rotating sprites in opengl

    Quote Originally Posted by User137
    Hmm.. i'm still not convinced

    At the init you say? It needs to be called individually when each texture is loaded somewhere after glBindTexture.

    It is easy to spot if linear filter is on when scaling graphics. For the smoothing issue, linear should be responsible for the inner contains of texture but further antialiasing can smoothen the borders.
    I have to call these texparm after every bindtexture?


    edit: it's now solved, i have to call these texparams after loading the texture only, a big thanks
    From brazil (:

    Pascal pownz!

  7. #7

    [SOLVED] Bad image when rotating sprites in opengl

    Yes, basically, in your for-loop, when you load the textures, you need to set the parameters for each. Quite brilliant actually, since if you wanted to you could have different settings per texture.

    Edit: Pwned by an edit. :roll:

  8. #8

    [SOLVED] Bad image when rotating sprites in opengl

    Quote Originally Posted by Robert Kosek
    Yes, basically, in your for-loop, when you load the textures, you need to set the parameters for each. Quite brilliant actually, since if you wanted to you could have different settings per texture.

    Edit: Pwned by an edit. :roll:
    thx for the attention anyway
    From brazil (:

    Pascal pownz!

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
  •