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

Author Topic: Window resize artifacts  (Read 993 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 1
    • View Profile
Window resize artifacts
« on: April 25, 2016, 09:17:29 pm »
I am currently working on a game project and I've encountered a problem when resizing the window.
I have a problem :

I use my custom sprite class with independant layers. These rely on VBOs. When I resize the window, they have one pixel (on texture size; when i use 2x zoom the issue is doubled) "imprecision" which makes them badly mix together.

It looks pretty subtle here but gets worse with view levels :
When you zoom in you can notice near the right of the boat, in the background layer, that the pixels are "inclinated" while they should be perfect vertical.
Similar problem : The main frame of the ship (not the sail) is offset by one from zero on the left if you look close enough.
Correct behavior (another window size) :

Code :
- Handling the window view : https://github.com/AsuMagic/game/blob/master/engine/engine.cpp#L32 (should be highlighting the right line if I haven't pulled a commit since you read this)
- Sprite code : https://github.com/AsuMagic/game/blob/master/engine/render/sprite.cpp (focus only on SpriteLayer methods)

There is another side problem : I use
Code: [Select]
view.zoom(1.f / static_cast<int>( view.getSize().x / (preferredWidth * map->getTilesize()) ));to set the view zoom as close as the preferred width (in tiles). But when the size is 3x, this also causes issues with tiles offsetting oddly. How can I get 3x zoom to work without this problem?

If that matters, I'm under Linux with proprietary nvidia drivers.