You are not logged in.
Hi,
as my english is not my main language and I don't think I will be able to explain it correctly, I'll post an image that I hope is self-explanatory
This is what I want. Basically, I want to draw only some parts of an image, based on another mask image. How can I do this with GRRLIB? I have been searching through documentation and boards, but I did not find anything related to this.
Offline
Right now there is no way to do that in GRRLIB. But you can make a function to do that very easily with GRRLIB_GetPixelFromtexImg. I don't know any better way to do it.
If you need help, just ask...
Offline
in fact crayon is right grrlib can't do logic between texture for now, but you can easily get this effect using :
GX_SetBlendMode
http://www.devkitpro.org/libogc/gx_8h.h … ea182c8eb6
have a look at the last param (logical operation)
i already coded something similar using this.
regards,
crayon : perhaps we can provide preparametered logic fonction via an update of GRRLIB_SetBlend and a new function
GRRLIB_TexLogic(GRRLIB_texImg src1, GRRLIB_texImg src2, operation, GRRLIB_texImg dst);
NNN
Offline
Thanks for your answers
I already saw GetPixelFromtex and SetPixelTotex but I thought it was going to be a very inefficient code. But at least it's a solution for now
This is the code:
void Graficos_MascaraImagen(){ int x,y; for(x=0;x<192;x++){ for(y=0;y<112;y++){ u32 masc=GRRLIB_GetPixelFromtexImg(x, y, GFX_Mask); if(masc==RGBA(0,0,0,255)){ GRRLIB_SetPixelTotexImg(x, y, GFX_Tetris, RGBA(0,0,0,0)); } } } }
This is only a test, but it works. Now I'm going to make it universal for any texture and any size.
Any suggestion to make it cleaner?
@NoNameNo, can you explain more detailed the SetBlendMode method? Some code would be very helpful
Offline
in fact if you dont need "real" time effect, GetPixelFromtex and SetPixelTotex fit well since you can pre calculate your need at start of you app, then use all your precalculated stuff.
if you really need real time effect on big textures, you surely need a little GX help using GX_SetBlendMode with logical operation.
in fact simply draw your original (or mask order can be important acording to the operation you selected)*
then use :
GX_SetBlendMode(GX_BM_LOGIC, GX_BL_ZERO, GX_BL_ZERO, and use the operation you want here )
list of operation : http://www.devkitpro.org/libogc/group__logicop.html
now draw your mask (or original order can be important acording to the operation you selected)*
use screen2texture to catch the result in a new texture.
then reset the blending mode to grrlib default using :
GRRLIB_SetBlend(GRRLIB_BLEND_ALPHA);
and voila...
Offline
Thank you
I'll stay with the first method, because I even calculate it before starting up GRRLIB. I still don't like it (maybe I'm too perfectionist) but the other method looks even more dirty to me.
Time for another question... On another topic!
Offline
for info i coded my best candy eyes demo effect tonight making some research about what i said about blending mode and mask stay tunned to see it soon
thx marc_max
Offline