I need some help figuring out why there is some bleeding or banding in my textures using KallistiOS directly. I previously used SDL and everything worked fine with BMP as my source for images, but unfortunately it was too slow for my needs and I decided to switch my drawing layer to using the PVR directly.
I ended up using PNG, here is the code I am using to test these functions:
Code:
if(png_load_texture(filename, &image->tex, PNG_MASK_ALPHA, &image->tw, &image->th) == -1)
{
free(image);
fprintf(stderr, "Could not load %s\n", filename);
return(NULL);
}
...
pvr_poly_cxt_t cxt;
pvr_poly_hdr_t hdr;
pvr_vertex_t vert;
pvr_poly_cxt_txr(&cxt, PVR_LIST_TR_POLY, PVR_TXRFMT_ARGB1555, image->tw, image->th, image->tex, PVR_FILTER_NONE);
pvr_poly_compile(&hdr, &cxt);
pvr_prim(&hdr, sizeof(hdr));
vert.argb = PVR_PACK_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
vert.oargb = 0;
vert.flags = PVR_CMD_VERTEX;
vert.x = image->x;
vert.y = image->y;
vert.z = image->layer;
vert.u = 0.0;
vert.v = 0.0;
pvr_prim(&vert, sizeof(vert));
vert.x = image->x + image->w;
vert.y = image->y;
vert.z = image->layer;
vert.u = 1.0;
vert.v = 0.0;
pvr_prim(&vert, sizeof(vert));
vert.x = image->x;
vert.y = image->y + image->h;
vert.z = image->layer;
vert.u = 0.0;
vert.v = 1.0;
pvr_prim(&vert, sizeof(vert));
vert.x = image->x + image->w;
vert.y = image->y + image->h;
vert.z = image->layer;
vert.u = 1.0;
vert.v = 1.0;
vert.flags = PVR_CMD_VERTEX_EOL;
pvr_prim(&vert, sizeof(vert));
}
Quite typical as you can see. I am using 320x240 and PM_RGB565, and loading a png that is 512x256, but only 320x240 pixels have my actual image, the rest have alpha. I am drawing a polygon that is 512x256 located at 0, 0 with the code above and the texture I am using is not showing properly.. that is, it has some banding, bleeding or form of distortion. As stated above, when using SDL it displays perfectly. I am wondering if I am doing something wrong or expecting the wrong thing. I simply want pixel perfect rendering of the texture to the screen. I am using either VGA or RGB via an XRGB-3 for display, so I know that the problem is somewhere in my code or expectations.
20110211_004.jpg
Close-up photo from LCD displayed via SDL
20110211_003.jpg
Same are close up on same LCD and scaler, using the above code
Thanks for your help.
Bookmarks