 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Nov 03, 2006 6:59 am Post subject: sceGuBlendFunc usage ? |
|
|
I would like to convert some glBlend* operations in GU sceGuBlendFunc, but i have some difficulties because there are some not even defined in pspgl.
The only one I could be sure (according what I found out in PSPGL) is the following two :
| Code: |
(1.0 x Cd + 1.0 x Cs) :
glBlendFunc(GL_ONE,GL_ONE);
glBlendEquationEXT(GL_FUNC_ADD_EXT);
--->
sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, 0xffffff, 0xffffff);
|
and
| Code: |
(1.0 x Cd - 1.0 x Cs) :
glBlendFunc(GL_ONE,GL_ONE);
glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
--->
sceGuBlendFunc(GU_REVERSE_SUBTRACT, GU_FIX, GU_FIX, 0xffffff, 0xffffff);
|
there are other two I dunno how to translate :
| Code: |
(0.5 x Cs + 0.5 x Cd) :
glBlendColorEXT(0.0,0.0,0.0,0.5);
glBlendFunc(GL_CONSTANT_ALPHA,GL_CONSTANT_ALPHA);
glBlendEquationEXT(GL_FUNC_ADD_EXT);
--->
sceGuBlendFunc(GU_ADD, ?, ?, ?, ?);
|
| Code: |
(1.0 x Cd + 0.25 x Cs) :
glBlendColorEXT(0.0,0.0,0.0,0.5);
glBlendFunc(GL_CONSTANT_ALPHA,GL_ONE);
glBlendEquationEXT(GL_FUNC_ADD_EXT);
--->
sceGuBlendFunc(GU_ADD, ?, GU_FIX, ?, 0xffffff);
|
I hope someone knows the answer :/ |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Nov 03, 2006 5:20 pm Post subject: |
|
|
anyone to help me ? i'm lost :(
I would be expecting something like :
| Code: |
(0.5 x Cs + 0.5 x Cd) :
glBlendColorEXT(0.0,0.0,0.0,0.5);
glBlendFunc(GL_CONSTANT_ALPHA,GL_CONSTANT_ALPHA);
glBlendEquationEXT(GL_FUNC_ADD_EXT);
--->
sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, 0x7f7f7f, 0x7f7f7f);
|
| Code: |
(1.0 x Cd + 0.25 x Cs) :
glBlendColorEXT(0.0,0.0,0.0,0.5);
glBlendFunc(GL_CONSTANT_ALPHA,GL_ONE);
glBlendEquationEXT(GL_FUNC_ADD_EXT);
--->
sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, 0x3f3f3f, 0xffffff);
|
Can anybody correct my code if i'm wrong ? |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Nov 03, 2006 8:38 pm Post subject: |
|
|
| Up : please tell me if i'm wrong :'( |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Sat Nov 04, 2006 12:36 am Post subject: |
|
|
Looks about right, yes. If you want to read it more easily you can use the macros available, so something like this ...
| Code: | | sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, GU_COLOR(0.25f,0.25f,0.25f,0.25f), GU_COLOR(1,1,1,1)); |
... would multiply the input source pixel with 0.25 and add it to the destination, much like you have written yourself already. _________________ GE Dominator |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sat Nov 04, 2006 1:35 am Post subject: |
|
|
Great ! thx chp !
well there is something i don't understand :
PSPGL defines GL_ONE as being equivalent to GU_COLOR(255, 255, 255, 0) and not to GU_COLOR(255, 255, 255, 255).
Is there any difference between :
| Code: | | sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, GU_COLOR(0.25f,0.25f,0.25f,0.25f), GU_COLOR(1,1,1,1)); |
and
| Code: | | sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, GU_COLOR(0.25f,0.25f,0.25f, 0), GU_COLOR(1,1,1, 0)); |
and
| Code: | | sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, GU_COLOR(0,0,0,0.25f), GU_COLOR(0,0,0,1)); |
? |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Mon Nov 06, 2006 10:05 pm Post subject: |
|
|
It probably depends on how you want the alpha-component of the color to affect the input. I have not properly tested how the alpha-vs-alpha blending is done on the PSP. On the PS2 the alpha-channel wasn't affected by blending, which is stopping me from answering which approach that is the correct one. _________________ GE Dominator |
|
| Back to top |
|
 |
|
|
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
|