blocksds / sdk

Main BlocksDS SDK repository
https://blocksds.github.io/docs/
164 stars 11 forks source link

Scaling accuracy with glSpriteScale in gl2d #211

Closed MasherZN closed 3 weeks ago

MasherZN commented 1 month ago

Scaling accuracy is not great with the current method in glSpriteScale() from gl2d

glSprite(50,50, GL_FLIP_NONE, &ruins[ATLAS_1_png]);
            glSpriteScale(150, 50, 1<<12,GL_FLIP_NONE, &ruins[ATLAS_1_png]);

the first sprite is drawing with glSprite , the second one with glSpriteScale with the normal scale 1<<12 image

AntonioND commented 4 weeks ago

Hmmmm yes, I see what you mean. I've created this patch that should fix the issue, can you check with it? https://github.com/blocksds/libnds/commit/0ac9e420c22e7b3219f90748a613661c3eefa41f

AntonioND commented 3 weeks ago

I think this issue is as resolved as it can be. Flipped textures are displayed correctly when they are displayed at 100% of the original size, which is the best we can get. When they are bigger than the original size the edges start behaving a bit strangely, but I don't think this is something that can be fixed.

If someone can get a better fix, feel free to submit a PR. This is the test ROM I've used: https://github.com/blocksds/sdk/tree/af7142a7058e9630c43e0074bf34ff33bf91165d/examples/gl2d/sprite_transform