Can someone see what's wrong with my code?
Code: Select all
unsigned char __attribute__((aligned(16))) solid_tex1[2] = { 0xff, 0x00 }; //YELLOW
unsigned char __attribute__((aligned(16))) solid_tex2[2] = { 0xf0, 0x00 }; //RED
....
// setup GU
sceGuInit();
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH);
sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH);
sceGuDepthBuffer((void*)0x110000,BUF_WIDTH);
sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
sceGuDepthRange(0xc350,0x2710);
sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
sceGuEnable(GU_SCISSOR_TEST);
sceGuDepthFunc(GU_GEQUAL);
sceGuEnable(GU_DEPTH_TEST);
sceGuFrontFace(GU_CCW);
sceGuShadeModel(GU_SMOOTH);
sceGuEnable(GU_CULL_FACE);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
// run sample
int val = 0;
for(;;)
{
sceGuStart(GU_DIRECT,list);
// clear screen
sceGuClearColor(0xff554433);
sceGuClearDepth(0);
sceGuClearStencil(0);
sceGuClear(GU_COLOR_BUFFER_BIT |
GU_STENCIL_BUFFER_BIT |
GU_DEPTH_BUFFER_BIT);
// setup matrices for cube
sceGumMatrixMode(GU_PROJECTION);
sceGumLoadIdentity();
sceGumOrtho(0,480,272,0, -250, 250);
sceGumMatrixMode(GU_VIEW);
{
ScePspFVector3 pos = {xx, yy, zz};
ScePspFVector3 rot = {rot_xx, rot_yy, rot_zz};
sceGumLoadIdentity();
sceGumTranslate(&pos);
sceGumRotateXYZ(&rot);
}
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
sceGuEnable(GU_TEXTURE_2D);
sceGuTexMode(GU_PSM_4444,0,0,0);
sceGuTexImage(0,1,1,1,solid_tex1);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
sceGuTexScale(1.0f,1.0f);
sceGuTexOffset(0.0f,0.0f);
sceGumDrawArray(GU_TRIANGLES, GU_TEXTURE_32BITF |
GU_COLOR_8888 | GU_VERTEX_32BITF |
GU_TRANSFORM_3D, 36, 0, left_box);
sceGuDisable(GU_TEXTURE_2D);
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
sceGuEnable(GU_TEXTURE_2D);
sceGuTexMode(GU_PSM_4444,0,0,0);
sceGuTexImage(0,1,1,1,solid_tex2);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
sceGuTexScale(1.0f,1.0f);
sceGuTexOffset(0.0f,0.0f);
sceGumDrawArray(GU_TRIANGLES, GU_TEXTURE_32BITF |
GU_COLOR_8888 | GU_VERTEX_32BITF |
GU_TRANSFORM_3D, 36, 0, left_frame);
sceGuDisable(GU_TEXTURE_2D);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuSwapBuffers();
}
sceGuTerm();