24bit - PSP screen? Help Please

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

24bit - PSP screen? Help Please

Post by AnonymousTipster »

Ok, I am writing a small library in which I want to take an RGB value from a function (255,255,255 format) and blit that pixel to the screen.
I think that ATM, with our knowledge of the PSP, we can only acheive 16bit colour. What I would like to know is how to display an RGB value on screen in 24bit colour, or how to convert it in-app to 16bit, and then blit that pixel.

Thanks for your help.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

As far as I know there is only 4 colour modes you can use on the PSP, 3 16bit mode variants and 1 32bit colour mode.

If you want to use 32bit mode (which is as close as you are going to get to 24bit) you need to called sceDisplaySetFrameBuf with 3 as the 3rd parameter.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Well, I'm using Nem's HelloWorld app, and i've set the startup.S file to load all needed kernel and display functions. I am setting the displayBuf's 3rd param to 3, but the image that is being drawn (I'm just using the sec logo) is in pink and is repeated 4 times on the screen.
Now that I am in 32bit mode (I think), how can I draw a single pixel to the screen from an RGB value?

Thank you for your patience, it is tricky to find your feet on a new OS.
jboldiga
Posts: 27
Joined: Mon Jun 20, 2005 10:16 am

Post by jboldiga »

convert it to an rgb value...if you are using nems code his images are all 16bit so instead of doing 5 5 5 you have to convert to 8 8 8 8 or even easier to make 32 bit images yourself. The only thing that really changes is your shifts.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Erm, still have a little bit of a problem, when accessing the vram, what format should you use, what is the line of code that the vram needs to take?

ATM, my xmain code looks like this:

Code: Select all

SetupCallbacks();
	pgInit();
	pgScreenFrame(2,0);
	

	while (1) {
		pgFillvram(0);
	//pgBitBlt(1,4,1,1,2,0xFF00);
		unsigned char *vptr;		//pointer to vram
	vptr=pgGetVramAddr(10,10);
	vptr[1+1*512] = 0xFF00FF;
	pgScreenFlipV();
	pgWaitVn(1);
	}
I have also tried "vptr[1+1*512] = 255,255,255;" and "vptr[1+1*512] = 255|255|255;" but they all display a turqoise pixel on the screen.

Sorry for the noobishness, but i'm used to DirectX.
pcostabel
Posts: 11
Joined: Sat Jun 25, 2005 1:19 am

Post by pcostabel »

Change PIXELSIZE to 2
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Ah, excellent, that fixes it!

Just for other users reference, I used

Code: Select all

sceDisplaySetFrameBuf(pg_vramtop+(pg_showframe?FRAMESIZE:0),LINESIZE,2,1);
Thank you all for your understanding help.
Post Reply