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 

Flickering with backbuffer usage[SOLVED]

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



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Oct 08, 2009 12:52 am    Post subject: Flickering with backbuffer usage[SOLVED] Reply with quote

Hi there,

i'm started the first PSP development in drawing some animated pixels to the PSP screen. I'm using draw buffer and backbuffer. After everything was drawn to the backbuffer I flip them. It's nothing really using GU and very simple. However, if I do NOT use sceDisplayWaitVblankStart(); the screen flicker, other wise it not flicker, but is very slow....

Here is my code snipped:
Code:

#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXELSIZE   4            //in short
#define   LINESIZE   512            //in short
#define   FRAMESIZE   (SCR_HEIGHT * LINESIZE * PIXELSIZE)

Color* pg_vramtop = (Color *)(0x40000000 | 0x04000000);
bool pg_drawframe = true;


Color *pgGetVramAddr()
{
   if (pg_drawframe)
      return pg_vramtop + FRAMESIZE / sizeof(Color);
   else
      return pg_vramtop;
}

void setPixel(int x,int y, Color color)
{
     Color* vram = pgGetVramAddr();
     vram[x + LINESIZE*y] = color;
}

int main(int argc, char* argv[])
{
   Color* vram;
    // setup of common call backs
   setupCallbacks();
   // run the application
   while(running()){

     vram = pgGetVramAddr();
                  // clear the drawbuffer
     memset(vram, 0, FRAMESIZE);
//create some fancy pixels using setPixel()                 
                 Render();
                sceDisplaySetFrameBuf(vram, LINESIZE, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_NEXTFRAME );
      pg_drawframe = pg_drawframe?false:true;
                //do not wait for Vblank start
                //sceDisplayWaitVblankStart();
   }
.....


The reoson why I do not want to use "sceDisplayWaitVblankStart();": It completely slows down everything ...

Any Ideas what may be wrong here ? Sorry that I'm just posting the code snippets, but I guess the kind of setting the pixels using some random method does not matter, doesn't it ?

Thanks in advance...
AnMaBaGiMa


Last edited by anmabagima on Thu Oct 08, 2009 4:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Oct 08, 2009 6:21 am    Post subject: Reply with quote

Your code snippet doesn't show the double-buffering you claim to be doing, just single buffering. Please post enough of the code that we can see how your program REALLY handles the buffers.
Back to top
View user's profile Send private message AIM Address
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Oct 08, 2009 6:39 am    Post subject: SOLVED Reply with quote

Hi,

I've solved it in using the Parameter PSP_DISPLAY_SETBUF_IMMEDIATE instead of PSP_DISPLAY_SETBUF_NEXTFRAME within
sceDisplaySetFrameBuf.

However, the double buffering is there:
Code:
Color *pgGetVramAddr()
{
   if (pg_drawframe)
      return pg_vramtop + FRAMESIZE / sizeof(Color);
   else
      return pg_vramtop;
}
points dependent of the flag "pg_drawframe" to two different addresses (buffers). The sceDisplaySetFrameBuf switches between these buffers...

Thanks.

Regards,
AnMaBaGiMa
Back to top
View user's profile Send private message
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