forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Ratty



Joined: 18 Sep 2005
Posts: 18

PostPosted: Thu Sep 22, 2005 11:38 am    Post subject: I can't blit 32bit image [nevermind, i fixed it] Reply with quote

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:

   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));
   
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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