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

Author Topic: Problem when resizing view to be same size as new window  (Read 3901 times)

0 Members and 1 Guest are viewing this topic.

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Problem when resizing view to be same size as new window
« on: December 02, 2015, 08:20:44 pm »
Using this code
(click to show/hide)
and the attached "image.png", when I press the resize button, the sprite stays exactly the same size as expected, however some parts of it are changed, and this looks very weird in my full project, especially since everything is drawn to line up at the pixel level. I've attached the image used, as well as a screenshot from before, and one from after with red circles identifying some of the weird bits. I am on windows 10 using a version of SFML I build myself last July with CMake and MinGW 5.1.
EDIT: I forgot to say, the console output says that the new width is 1920 and the new height is 1001.
« Last Edit: December 02, 2015, 09:42:05 pm by shadowmouse »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problem when resizing view to be same size as new window
« Reply #1 on: December 03, 2015, 10:27:40 pm »
Have you tried rounding the view's centre? With your new height of 1001, the new view centre's y would be 500.5, which may cause rounding/interpolation errors.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Problem when resizing view to be same size as new window
« Reply #2 on: December 04, 2015, 08:51:45 pm »
Nope, I changed the centre of the view to be 0,0, then commented out the line in the handling of the resize event that changes the centre, and the problem remains exactly the same. I'm really confused as to why this is happening as no zooming is happening, so I don't know why there are what look like interpolation errors.

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Problem when resizing view to be same size as new window
« Reply #3 on: December 04, 2015, 11:18:45 pm »
I'd try modifying the texture to be power of 2 dimensions.

Though, I made an interesting observation.

I ran your example with the image provided. I only changed the std::cout line to view.getSize().* instead, to see if there was something changing in the view.

The even/oddness of the view size is making the effect, and it's reproducible.

When the new width is odd, the sprite/texture gets shifted noticeably to the right a pixel or so.
When the new width is even, the sprite/texture gets shifted noticeably to the left a pixel or so.

If the current width is already even, and the new width is even, there is no movement, and the same goes for odd.

Same goes for the height.

What graphics card and driver do you have?

For reference, I'm on a GTX 970 with the 359.00 driver. (Tested on Windows 8.1, haven't tried it on Linux)
« Last Edit: December 04, 2015, 11:27:57 pm by dabbertorres »

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Problem when resizing view to be same size as new window
« Reply #4 on: December 04, 2015, 11:36:00 pm »
I'm on Windows 10 64 bit with a GeForce 820M which via dxdiag has a driver version number of 10.18.13.5362 (which is from 23/07/2015).

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Problem when resizing view to be same size as new window
« Reply #5 on: December 04, 2015, 11:41:03 pm »
Are you seeing what I'm seeing?

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Problem when resizing view to be same size as new window
« Reply #6 on: December 04, 2015, 11:49:48 pm »
No matter what the starting size is, when I resize to an even height, I get the weird corners and when I resize to an odd height, I get a no change in the shape.

 

anything