We pretend we have an animation that contains 2 by 2 sprites and one of them has a color that isn't transparent on the edge to the other sprites. Now we want to ROTOZOOMANIM one of the other sprites, say index #0. What happens is that the border from the index #1 and #2 sprites will show up on the rotating sprite #0 (if the bordering pixel isn't transparent). See the example that only has a red border on the sprite below (#2):
(This only happens if SMOOTHSHADING TRUE is activated.)
// --------------------------------- //
// Project: test_rotate
// Start: Saturday, January 31, 2009
// IDE Version: 6.147
LIMITFPS 15
DRAWLINE 0,15, 50,15, RGB(255,255,255)
DRAWLINE 0,32, 50,32, RGB(255,0,0)
GRABSPRITE 1, 0,0, 64,64
SAVESPRITE "test.bmp", 1
LOADANIM "test.bmp", 2, 32,32
phi = -90
WHILE TRUE
SMOOTHSHADING TRUE
IF KEY(203) THEN INC phi, 1
IF KEY(205) THEN DEC phi, 1
PRINT "Anim:", 50, 40
ROTOZOOMANIM 2, 0, 50,50, phi, 1
PRINT "Sprite:", 120, 40
ROTOZOOMSPRITE 1, 120,50, phi, 1
DEBUG phi + "\n"
SHOWSCREEN
WEND
I think SMOOTHSHADING does a bit of blending around consecutive pixels - hence the red border. Or perhaps it does anti-aliasing, but a bit too agressively :)
Would be nice if it didn't though!
OK. Now, the problem is, that all sprites are stored on one bitmap (texture).
Using smoothshading, you tell OpenGL to interpolate "half" pixels from their neighbour pixels.
OpenGL, however has no Idea that you only want pixels in the range [0;31] for that. And there's no way to tell it so.
So, the only solution is disabling smoothshading or use a seperate sprite for each animation.
I know, it's not a satisfying answer, but there's no way to change this for me. I'm not lazy, it's just impossible.
I know the problem, just put it in the documentation so others know it also :-) I have seen this question a few times now.
Fixed in next update!