Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Scale creating lines around sprites  (Read 1609 times)

0 Members and 1 Guest are viewing this topic.

Synyster_Coder

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Scale creating lines around sprites
« on: September 26, 2013, 01:24:17 pm »
Hi everyone,

I have had a problem with scaling sprites for a while now which is, when you scale a sprite above 1.0f the sprite will get a few extra pixels around it from the image tile that it came from. I have fixed this before by just adding a few extra pixels around the sprite on the tile that are alpha a "padding" if you will, but this just seems like a lot more hassle than just trying to fix the problem at the root.

I have been looking through the SFML Texture.cpp and found the functions setSmooth() and create() which calls the opengl function glTexParameteri, after looking online people are saying that if you use GL_CLAMP_TO_EDGE in the parameters for this instead of GL_NEAREST this could fix the problem.

So what I'm asking is will this fix the problem? May there by any implication from using this? And if not how come this isn't the default?

Thanks for the thoughts :D

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: Scale creating lines around sprites
« Reply #1 on: September 26, 2013, 01:47:00 pm »
Download the source code, change the source code, recompile it, test it, tell us the results  :D



AlexAUT

Synyster_Coder

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: Scale creating lines around sprites
« Reply #2 on: September 26, 2013, 03:18:55 pm »
Ok I have gone through the code changing the parameters to no luck, I can get rid of the lines by setting the GL_TEXTURE_MAG_FILTER to GL_NEAREST but then the textures are not smooth. I have changed L_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T to GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, GL_MIRRORED_REPEAT, GL_REPEAT, GL_MIRROR_CLAMP_TO_EDGE and its still the same im not too sure what to do about this....

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: Scale creating lines around sprites
« Reply #3 on: September 26, 2013, 04:13:37 pm »
Could this be related to this?

Synyster_Coder

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: Scale creating lines around sprites
« Reply #4 on: July 15, 2014, 04:04:01 pm »
Well I fixed this by turn off texture smoothing on all the textures, doing all transformations on the sprites, drawing them to a single rendertexture that is set smooth and then drawing that to the window.

Thanks for your help guys! :D