I'm researching how to get better performance in my new game and I have problems with display list.... -_-'
Big question is - Do I need to create display list before setting sceGumPerspective or sceGumOrtho ?
Here I'm explaining - I'm initializing GU, next creating display list for small cube and setting perspective - everything is working ok. But if I initialize GU then setting perspective and create display list for cube - nothing on the screen :/
I know this might be dumb question but did any one encountered this?
Working code looks like this:
Code: Select all
dList = malloc( 262144 );
// Init GU
sceGuInit();
gumInit();
sceGuStart( GU_DIRECT, dList );
fbp0 = 0;
sceGuDrawBuffer( GU_PSM_8888, (void *)fbp0, BUF_WIDTH );
fbp0 += FRAME_BUFFER_SIZE;
sceGuDispBuffer( SCR_WIDTH, SCR_HEIGHT, (void *)fbp1, BUF_WIDTH);
fbp0 += FRAME_BUFFER_SIZE;
valloc(FRAME_BUFFER_SIZE);
sceGuDepthBuffer((void *)fbp0, FRAME_BUFFER_WIDTH);
fbp0 += (FRAME_BUFFER_WIDTH*SCR_HEIGHT*2); // 16bit depth buffer
valloc(FRAME_BUFFER_WIDTH*SCR_HEIGHT*2);
sceGuOffset( 2048 - (SCR_WIDTH/2), 2048 - (SCR_HEIGHT/2));
sceGuViewport( 2048, 2048, SCR_WIDTH, SCR_HEIGHT);
sceGuDepthRange( 65535, 0);
// Set Render States
sceGuScissor( 0, 0, SCR_WIDTH, SCR_HEIGHT);
sceGuEnable( GU_SCISSOR_TEST );
sceGuDepthFunc( GU_GEQUAL );
sceGuEnable( GU_DEPTH_TEST );
sceGuShadeModel( GU_SMOOTH );
sceGuFrontFace( GU_CW );
//culling
sceGuEnable(GU_CULL_FACE);
sceGuEnable(GU_CLIP_PLANES);
sceGuEnable(GU_LIGHTING);
sceGuEnable(GU_LIGHT0);
sceGuAlphaFunc(GU_GREATER,0,0xff);
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
sceGuTexMode(GU_PSM_8888,0,0,0);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA);
sceGuTexFilter(GU_NEAREST,GU_NEAREST);
sceGuTexWrap(GU_REPEAT,GU_REPEAT);
sceGuTexScale(1,1);
sceGuTexOffset(0,0);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
//for analog pad
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
// finish
//init cube list
sceGuStart(GU_CALL, boxList);
sceGumDrawArray( GU_TRIANGLES, GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D,12*3,0,boxVerts);
sceGuFinish();
//set perspective
sceGumMatrixMode(GU_PROJECTION);
sceGumLoadIdentity();
sceGumPerspective( 75.0f, 16.0f/9.0f, 1.0f, 100.0f);
sceGumMatrixMode(GU_VIEW);
sceGumLoadIdentity();
sceGuClearColor( GU_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
sceGuClearDepth(0);
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
Partially Solved
I had only to remove :
Code: Select all
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
Haha but now another bug appeared - I cant use sceGumLookAt(&cameraPos, &lookAtPos, &upVec); -_-' it's simple stop working....