I'm using the following initialization,
Code: Select all
#define VRAM_ADDR 0x04000000
#define MAX_DRAW_BUFFER_SIZE (0x077800)
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
void* drawBufferAddress = 0;
{
sceGuInit();
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_5551,(void*)0,BUF_WIDTH);
sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)MAX_DRAW_BUFFER_SIZE,BUF_WIDTH);
sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
sceGuEnable(GU_SCISSOR_TEST);
sceGuClear(GU_COLOR_BUFFER_BIT);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(1);
}
Code: Select all
{
sceKernelDcacheWritebackAll();
sceGuStart(GU_DIRECT,list);
sceGuDrawBufferList(GU_PSM_5551,(void*)drawBufferAddress,512);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
sceGuEnable(GU_SCISSOR_TEST);
sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
sceGuDisable(GU_DEPTH_TEST);
sceGuDisable(GU_ALPHA_TEST);
sceGuTexMode(GU_PSM_5551,0,0,0);
sceGuTexImage(0,Width,Height,512,(void*)GFX.Screen);
sceGuTexFunc(GU_TFX_REPLACE,0);
sceGuTexFilter(GU_NEAREST,GU_NEAREST);
sceGuTexScale(1.0f/Width,1.0f/Height);
sceGuTexOffset(0,0);
sceGuTexWrap(GU_CLAMP,GU_CLAMP);
struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(4 * sizeof(struct Vertex));
vertices[0].u = -128;
vertices[0].v = -112;
vertices[0].x = 0;
vertices[0].y = 0;
vertices[1].u = 128;
vertices[1].v = -112;
vertices[1].x = 480;
vertices[1].y = 0;
vertices[2].u = -128;
vertices[2].v = 112;
vertices[2].x = 0;
vertices[2].y = 272;
vertices[3].u = 128;
vertices[3].v = 112;
vertices[3].x = 480;
vertices[3].y = 272;
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_VERTEX_16BIT|GU_TRANSFORM_2D,4,0,vertices);
sceGuFinish();
sceGuSync(0,0);
drawBufferAddress = sceGuSwapBuffers();
}