From: Lawrence S. <blu...@gm...> - 2016-12-29 00:42:04
|
I’m guessing your texture itself has a white border around whatever you’re drawing (i.e, it’s not actually 512x512 pixels in size, but you’ve extended the image by just resizing it and filling that in as white)? If so, what you need to do is adjust the u and v coordinates on each vertex. These two values are what portion of the texture you want to display. The left and top of the texture correspond to 0.0 of u and v respectively, whereas the full extent of the texture (in this case 512 pixels over from the left and 512 pixels down from the top) correspond to 1.0 of u and v respectively. If your texture is actually 320x240 (for instance), then you’d want to adjust the u and v on the bottom and right side vertices (i.e, everything where you have 1.0) to be (320.0f / 512.0f) and (240.0f / 512.0f). Hopefully I’ve guessed what your issue is correctly and that helps understand the process. - Lawrence > On Dec 28, 2016, at 4:12 PM, Nathan Meier <gro...@gm...> wrote: > > I've been learning how to program with KOS. And currently I can display images and > even move them around. But what I'm trying to figure out is how can I display the > image without the white border behind it. Here's my current code for drawing one of the graphics: > > void draw_ground(void) { > pvr_poly_cxt_t cxt; > pvr_poly_hdr_t hdr; > pvr_vertex_t vert; > > pvr_poly_cxt_txr(&cxt, PVR_LIST_OP_POLY, PVR_TXRFMT_RGB565, 512, 512, ground_tex, PVR_FILTER_BILINEAR); > 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 = gx; > vert.y = gy; > vert.z = 1; > vert.u = 0.0; > vert.v = 0.0; > pvr_prim(&vert, sizeof(vert)); > > vert.x = gx + size; > vert.y = gy; > vert.z = 1; > vert.u = 1.0; > vert.v = 0.0; > pvr_prim(&vert, sizeof(vert)); > > vert.x = gx; > vert.y = gy + size; > vert.z = 1; > vert.u = 0.0; > vert.v = 1.0; > pvr_prim(&vert, sizeof(vert)); > > vert.x = gx + size; > vert.y = gy + size; > vert.z = 1; > vert.u = 1.0; > vert.v = 1.0; > vert.flags = PVR_CMD_VERTEX_EOL; > pvr_prim(&vert, sizeof(vert)); > } > > any help figuring this out would be appreciated. > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________ > cadcdev-kallistios mailing list > cad...@li... > https://lists.sourceforge.net/lists/listinfo/cadcdev-kallistios |