PDA

Voir la version compl鋈e : [無ibrary][Aide] A problem with rotation


kavaler
24/01/2008, 01h26
I'm trying to rotate a small (15x15) circularly shaped image that was created using GIMP. It is stored as a 15 x 15 PNG with alpha. I've included the code and the image so you can see what I'm talking about. When I rotate the image I get blobs that don't really look very circular and sometimes have extra lines on the top or missing lines on the side or the bottom, not something circular as I expected. I'm linking against the latest version of uLibrary (1.1a). Any help would be appreciated.

Robert

jo3_sum
24/01/2008, 01h59
I use Oslib not 無ibrary, but it seems almost the same.

You should try this instead because you didn't sync the frames every time the angle changed.
#include <ulib/ulib.h>

#include "puck1_png.h"

main()
{
int i, j;
UL_IMAGE *puckImage;

ulInit(UL_INIT_ALL);
ulInitGfx();
ulInitText();

puckImage = ulLoadImageFilePNG((const char *)puck1_png, (int) puck1_png_size, UL_IN_VRAM, UL_PF_PAL5_A3);
ulImageSetRotCenter(puckImage);

for(;;) {
puckImage->angle = 0;
for(i=16; i<256; i+=32) {
for(j=16; j<192; j+=32) {
ulStartDrawing2D();
puckImage->stretchX = 15;
puckImage->stretchY = 15;
ulDrawImageXY(puckImage, i, j);
puckImage->angle += 4;
ulEndDrawing();
ulSyncFrame();
}
}
}
}

kavaler
25/01/2008, 11h35
The code I provided should show 48 different phases on one screen at one time. In reality I want to show the image spinning, but I wrote this simple program to illustrate the problem. I tried the same program using an image file that is used in a PAlib example (frisbee.png). It is 32x32 and shows many of the same artifacts. The PAlib program that uses 2D sprites seems to be artifact free.

Robert

kavaler
28/01/2008, 07h26
I found the source of the added and missing lines: NO$GBA is not doing the same things as the real DS. The real DS is artifact free, but still does not render the final images as round. I also found that if I start with a much bigger image (63x63 for example) and use stretch and rotate at the same time, I get a better looking result, but still not perfect.

Update: Version 2.6a of NO$GBA seems to have fixed some if not all of the artifact issues. I was previously using Version 2.6.

Brunni
01/02/2008, 01h05
The rotation is not perfect because the DS hardware is not very precise (and it doesn't have bilinear filtering). Your screenshot really shows that there's a problem, but if it's not completely round when spinning, then that's normal (GBA games had the same problem if you can remember about it).