Code: Select all
struct Vertex
{
unsigned short u, v;
unsigned short color;
short x, y, z;
};
int main(int argc, char* argv[])
{
pspDebugScreenInit();
SetupCallbacks();
sceGuInit();
// setup
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_5551,(void*)0,512);
sceGuDispBuffer(480,272,(void*)0x88000,512);
sceGuDepthBuffer((void*)0x110000,512);
sceGuOffset(2048 - (480/2),2048 - (272/2));
sceGuViewport(2048,2048,480,272);
sceGuDepthRange(0xc350,0x2710);
sceGuScissor(0,0,480,272);
sceGuEnable(GU_SCISSOR_TEST);
sceGuFrontFace(GU_CW);
sceGuEnable(GU_TEXTURE_2D);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
struct Vertex* vertices;
vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
vertices[0].u = 0;
vertices[0].v = 0;
vertices[0].color = 0;
vertices[0].x = 0;
vertices[0].y = 0;
vertices[0].z = 0;
vertices[1].u = 2;
vertices[1].v = 2;
vertices[1].color = 0;
vertices[1].x = 32;
vertices[1].y = 32;
vertices[1].z = 0;
unsigned short __attribute__((aligned(16))) pixels[4];
//Setting the pixels of the texture
pixels[0] = 0xff00;
pixels[1] = 0xff00;
pixels[2] = 0xffff;
pixels[3] = 0xffff;
while (!done)
{
sceGuStart(GU_DIRECT,list);
sceGuTexMode(GU_PSM_5551,0,0,0);
sceGuTexImage(0,2,2,2,pixels);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
sceGuTexFilter(GU_NEAREST,GU_NEAREST);
sceGuTexScale(1.0f/2.0f,1.0f/2.0f);
sceGuTexOffset(0.0f,0.0f);
sceGuAmbientColor(0xffffffff);
sceGuClearColor(0x0);
sceGuClear(GU_COLOR_BUFFER_BIT);
sceGuDrawArray( GU_SPRITES,
GU_TEXTURE_16BIT|GU_COLOR_5551|GU_VERTEX_16BIT|GU_TRANSFORM_2D,
2,
0,
vertices);
sceGuFinish();
sceGuSync(0,0);
sceGuSwapBuffers();
}
sceGuTerm();
sceKernelExitGame();
return 0;
}