I can't blit 32bit image [nevermind, i fixed it]

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Ratty
Posts: 18
Joined: Sun Sep 18, 2005 12:04 pm

I can't blit 32bit image [nevermind, i fixed it]

Post by Ratty »

EDIT: nevermind i fixed it. I should have used:
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 &#40;j = 0; j < m_iWidth; j = j+sliceSize&#41; &#123;
		vertices = &#40;struct Vertex*&#41;sceGuGetMemory&#40;2 * sizeof&#40;struct Vertex&#41;&#41;;

		vertices&#91;0&#93;.u = j; vertices&#91;0&#93;.v = 0;
		vertices&#91;0&#93;.color = 0;
		vertices&#91;0&#93;.x = j; vertices&#91;0&#93;.y = 0; vertices&#91;0&#93;.z = 0;
		vertices&#91;1&#93;.u = j+sliceSize; vertices&#91;1&#93;.v = m_iHeight;
		vertices&#91;1&#93;.color = 0;
		vertices&#91;1&#93;.x = j+sliceSize; vertices&#91;1&#93;.y = m_iHeight; vertices&#91;1&#93;.z = 0;

		// draw in the top left. results in a big black square
		sceGuDrawArray&#40;GU_SPRITES, GU_TEXTURE_16BIT|GU_COLOR_8888|GU_VERTEX_16BIT|GU_TRANSFORM_2D, 2, 0, vertices&#41;;
	&#125;

	// draw in bottom right. this method works
	sceGuCopyImage&#40;GU_PSM_8888, 0, 0, m_iWidth, m_iHeight, m_iWidth, m_iPixels, 480-64, 272-64, 512, &#40;void*&#41;&#40;0x04000000+&#40;u32&#41;framebuffer&#41;&#41;;
	
Post Reply