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 :
http://i.imgur.com/FxSVHiP.pngWhen 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) :
http://i.imgur.com/FFLIY3m.pngCode :
- 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
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.
Thanks!