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 

16-bit graphics mode.. I'm blowing it somewhere :)

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



Joined: 30 Aug 2005
Posts: 29

PostPosted: Wed Oct 26, 2005 5:16 am    Post subject: 16-bit graphics mode.. I'm blowing it somewhere :) Reply with quote

hey all,

I generally write most of my code to be cross platform, and my latest little puzzler game is no exception; runs fine on Palm OS, Pocket PC, Windows and others; my PSP port is showing up with nasty colours though, so something is funked up for me :)

For my CaSTaway project I'm using 4444 mode with no problems (since the Atari ST has 444 colour itself, this works well); for Manticore here, I'm using 16bit colour on all platforms. (ie: RGB-565 for instance, whatever the platform needs.. but internally its stored in RGB-565 format.)

When using 16bit mode, things always show up but all tinted nastily.

Some code snippets..

setting up:

if ( g_screen_is4444 ) {
sceGuDrawBuffer(GU_PSM_4444,(void*)0,512);
} else {
sceGuDrawBuffer(GU_PSM_5650,(void*)0,512);
}

Blit code:

if ( g_screen_is4444 ) {
sceGuTexMode ( GU_PSM_4444, 0, 0, 0 );
} else {
sceGuTexMode ( GU_PSM_5650, 0, 0, 0 );
}
sceGuTexImage ( 0, 512, 512, 512, pixels );
sceGuTexFunc ( GU_TFX_REPLACE, GU_TCC_RGB );
sceGuTexFilter ( GU_NEAREST, GU_NEAREST );
sceGuTexScale ( 1.0f/512.0f, 1.0f/512.0f ); // scale UVs to 0..1
sceGuTexOffset ( 0.0f, 0.0f );
sceGuAmbientColor ( 0xffffffff );

// do a striped blit (takes the page-cache into account)
unsigned char stripe = 0;
for ( j = 0; j < 480; j = j+SLICE_SIZE ) {
//vertex_t *vertices = g_vertices + ( 2 * stripe );
vertex_t *vertices = (vertex_t*)sceGuGetMemory(2 * sizeof(vertex_t));

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+SLICE_SIZE; vertices[1].v = 272;
vertices[1].color = 0;
vertices[1].x = j+SLICE_SIZE; vertices[1].y = 272; vertices[1].z = 0;

sceGuDrawArray ( GU_SPRITES,
GU_TEXTURE_16BIT | GU_COLOR_4444 /*565*/ | GU_VERTEX_16BIT |
GU_TRANSFORM_2D, 2, 0, vertices );

sceKernelDcacheWritebackInvalidateAll();
//sceKernelDcacheWritebackAll();

stripe++;
} // for

(note I do fix the 565 inthe GuDrawArray)

So in 4444 everything works, but all borked up. (some things with very low colour usage work fine, others are a total mess.)

I'm sure its a totallly ovious mistake.. let me know so I can whip myself :)

jeff
_________________
--
Have you played Atari today?
Back to top
View user's profile Send private message Visit poster's website AIM Address
Paco



Joined: 09 Oct 2005
Posts: 54

PostPosted: Wed Oct 26, 2005 6:18 am    Post subject: Reply with quote

Make sure you set up the DrawBuffer format before calling sceGuDisplayBuffer or whatever the name is... the pixel format for the video mode in the Display call is taken from the (previous) call to sceGuDrawBuffer().
_________________
Paco
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