sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
and
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT|GU_COLOR_5551|GU_VERTEX_16BIT|GU_TRANSFORM_2D, 2, 0, vertices);
Hi,
I'm trying to draw a 32bit image (png) in a similar fashion to the blit sample, but all i end up getting is a large black square. My code is below. It uses sceGuCopyImage to draw the same image in the bottom right of the screen to confirm the image is fine. In the top left "should" be the blitted image drawn as a sprite using sceGuDrawArray, but it's just a big black square.
Does anyone know what it is i'm doing wrong? Thanks.
Whole thing is at : http://shitsoftware.com/testdizzy.tar.gz
Code: Select all
unsigned int sliceSize = 64;
unsigned int j;
sceGuTexMode(GU_PSM_8888,0,0,0);
sceGuTexImage(0, 64, 64, 64, m_iPixels);
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
sceGuTexFilter(GU_NEAREST, GU_NEAREST);
sceGuTexWrap(GU_CLAMP,GU_CLAMP);
sceGuTexScale(1,1);
sceGuTexOffset(0.0f,0.0f);
sceGuAmbientColor(0xffffffff);
struct Vertex* vertices;
printf(" W: %d H: %d", (int)m_iWidth, (int)m_iHeight);
for (j = 0; j < m_iWidth; j = j+sliceSize) {
vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
vertices[0].u = j; vertices[0].v = 0;
vertices[0].color = 0;
vertices[0].x = j; vertices[0].y = 0; vertices[0].z = 0;
vertices[1].u = j+sliceSize; vertices[1].v = m_iHeight;
vertices[1].color = 0;
vertices[1].x = j+sliceSize; vertices[1].y = m_iHeight; vertices[1].z = 0;
// draw in the top left. results in a big black square
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT|GU_COLOR_8888|GU_VERTEX_16BIT|GU_TRANSFORM_2D, 2, 0, vertices);
}
// draw in bottom right. this method works
sceGuCopyImage(GU_PSM_8888, 0, 0, m_iWidth, m_iHeight, m_iWidth, m_iPixels, 480-64, 272-64, 512, (void*)(0x04000000+(u32)framebuffer));