sceGuOffset

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

Moderators: cheriff, TyRaNiD

Post Reply
Nuclear Bit
Posts: 6
Joined: Sun Oct 02, 2005 12:58 am

sceGuOffset

Post by Nuclear Bit »

I started developing some samples to get used to the GU,
I have some code running, however there is a line that is comming back in every sample but I do not quit understand it (and I hate using lines I do not understand):

sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));

What is the meaning of that gu offset? I read in the .h file that the PSP has a virtual coordinate space and it has something to do with that, couldn't find more. I don't think there is no GL equivalent for that either (or am I wrong?)
Anyone with more info on that offset?

thanks,
NB
ashleydb
Posts: 26
Joined: Mon Oct 03, 2005 2:06 am
Location: USA
Contact:

Post by ashleydb »

The way I understand it, the PSP is essentially rendering to a texture which is 4096 x 4096. The offset call means you are only drawing to a section of that area the size of the PSP screen (480 x 272) in the direct center of that 4096 x 4096 area. That section is then what is displayed on the screen.
www.PSP-Files.com - PSP News, Hacks etc.

www.HiAsh.com - My work and stuff
Nuclear Bit
Posts: 6
Joined: Sun Oct 02, 2005 12:58 am

Post by Nuclear Bit »

Thanks for the reply,
in fact yes that's what I was thinking too, but then it seems that the command is defining exactly the same as the setup of the viewport command that is usually following the GU offset:
sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
the viewport command has the centerX and centerY within the larger window (4096x4096) and even more : the screen dimension.
So the difference between the GuOffset & the Viewport position becomes a bit unclear...
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

sceGuViewport() and sceGuOffset() control two different aspects of the hardware.

The coordinates from sceGuViewport() is applied by the 3D transform pipe to offset the transformed coordinate into screenspace. By using this, you can scale & move the viewport for free more or less.

sceGuOffset() sets where in the virtual coordinate space of 4096x4096 that the PSP will translate the framebuffer. This is most likely used to give enough space for scissoring until clipping has to be used.
GE Dominator
Nuclear Bit
Posts: 6
Joined: Sun Oct 02, 2005 12:58 am

Post by Nuclear Bit »

ok, is clear now.
thanks
Post Reply