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 

Creating display list after sceGumPerspective ??

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



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Sat Feb 28, 2009 6:31 am    Post subject: Creating display list after sceGumPerspective ?? Reply with quote

Hi

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:
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();


Any ideas ?

Partially Solved
I had only to remove :
Code:
sceGumMatrixMode(GU_MODEL);
      sceGumLoadIdentity();

from perspective settings end put at the beginning of the rendering function....

Haha but now another bug appeared - I cant use sceGumLookAt(&cameraPos, &lookAtPos, &upVec); -_-' it's simple stop working....
Back to top
View user's profile Send private message Visit poster's website
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