 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Fri Nov 03, 2006 2:40 pm Post subject: strip blitting + image offsets == trouble |
|
|
For some reason, my blitting function isn't working. It doesn't resize properly when I change the width or height, and I get weird results when the offsets are changed. Anyone know what I'm doing wrong?
| Code: | void drawImageFast(float x, float y, float width, float height, float u0, float u1, float v0, float v1, IMAGE *img)
{
float ii = 0;
short slice = 32;
sceGuTexImage(0,img->realWidth,img->realHeight,img->realWidth,(void*)img->data);
for(i = 0; ii < u1; ii += slice) {
VertexUV* vertices = (VertexUV*)sceGuGetMemory(2 * sizeof(VertexUV));
slice = 32;
if (ii + slice > u1) slice = width - ii;
vertices[0].u = u0 + ii;
vertices[0].v = v0;
vertices[0].x = x + ii;
vertices[0].y = y;
vertices[1].u = u0 + ii + slice;
vertices[1].v = v0 + v1;
vertices[1].x = x + ii + slice;
vertices[1].y = y + height;
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
}
} |
|
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Nov 03, 2006 5:15 pm Post subject: |
|
|
I can read in /pspsdk/gu/doc/commands.txt :
| Quote: | Floats processed in the command-stream are 24 bits instead of 32 that are
used by the CPU. Conversion from 32 to 24 bits is done by shifting the
value down 8 bits, losing the least significant bits of the mantissa. |
if it does so and have 256.0 as a float value, would it be converted into 1.0 because of losing the least significant bits of the mantissa !?
Well, I'm totaly new with GU but I hope you will find your error and share your solution :) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|