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

Author Topic: Tearing issue?  (Read 2560 times)

0 Members and 1 Guest are viewing this topic.

Thunderhammer

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Tearing issue?
« on: December 07, 2015, 08:49:16 pm »
I'm a new SFML user and i'm using it to complete a final project for a programming class I'm taking.

I'm having an issue which I think is the result of screen or image tearing but I'm not sure. I've attached an image of the the game I'm working on using some Megaman X sprites. You'll notice some black rectangles extending to the right of the sprite, and part of the bottom of his foot is cut off.

I've tried using Vsync, limiting framerate, and  setting all my textures to setSmooth(false). Any help would be much appreciated. I can upload more example images as well if necessary, as well as any source code excerpts anyone would think are relevant.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Tearing issue?
« Reply #1 on: December 08, 2015, 09:11:03 am »
Screen tearing looks different.

You're probably making another mistake at rendering, for example not strictly adhering to the clear-draw-display cycle. But we can't tell without seeing code, please come up with a minimal complete example (read that post carefully!)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Tearing issue?
« Reply #2 on: December 08, 2015, 11:01:27 am »
This might also mean you're somehow using texture coordinates outside the actual texture (without repetition being enabled).

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Tearing issue?
« Reply #3 on: December 08, 2015, 03:55:55 pm »
I zoomed into your image to have a closer look and got confused by the JPEG compression (for a short time) as it has added texture to the black rectangles.

Also, your image looks a bit...rude.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Thunderhammer

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Tearing issue?
« Reply #4 on: December 09, 2015, 12:02:00 am »
Thanks for your replies. I found the solution. When I was calling setTexture() on my sprite I wasn't including the second paramter for resizing the underlying rectangle of the sprite.

so by calling Sprite.setTexture(Texture, true); I fixed my problem.