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: Select all
#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();
}
.....
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