SANiK
Joined: 05 Jul 2005 Posts: 29
|
Posted: Fri Jun 05, 2009 9:18 am Post subject: [PSP] sceGuScissor mislabel fix |
|
|
Issue:
sceGuScissor does not take in:
startX, startY, width, height
but instead takes in:
startX, startY, endX, endY
You can optionally change the 'w' to 'stopX' and 'h' to 'stopY'
in this file:
/trunk/pspsdk/src/gu/sceGuScissor.c
But the more important one to update I guess is:
/trunk/pspsdk/src/gu/pspgu.h
(CTRL+F for sceGuScissor)
This below is the fixed version:
(Also, originally the comment description was:
* Set what to scissor within the current viewport"
This is somewhat misinformative because sceGuScissor is not affected by the sceGuViewport (it's not contained within the viewport), but by sceGuOffset which dictates the 'top-left' position in the framebuffer)
Code: |
/**
* Set what to scissor within the current framebuffer
*
* Note that scissoring is only performed if the custom scissoring is enabled (GU_SCISSOR_TEST)
*
* @param x - Left of scissor region
* @param y - Top of scissor region
* @param stopX - Right of scissor region
* @param stopY - Bottom of scissor region
**/
void sceGuScissor(int x, int y, int stopX, int stopY);
|
---------------Disregard the bottom-------------------------
Anyways, for people googling on how to simulate glViewport using sceGuViewport:
PC-GL:
Code: |
#define sgl_viewport(a_x, a_y, a_width, a_height) glViewport(a_x, a_y, a_width, a_height)
|
PSP:
Code: |
#define sgl_viewport(a_x, a_y, a_width, a_height) { sceGuViewport(1808+(a_x)+((a_width)/2), 2184-(a_y)-((a_height)/2), a_width, a_height); sceGuScissor(a_x, 272-(a_y)-(a_height), (a_x)+(a_width), 272-(a_y)); }
|
(Remember, on the PC-GL, y=0 is on the bottom, whilst on the PSP y=0 is up top, and this flip is accounted for by the macro) |
|