Homebrew Several questions about Citro2d + Citro3d

haloopdy

New Member
OP
Newbie
Joined
May 29, 2021
Messages
4
Trophies
0
Age
30
XP
25
Country
United States
I apologize if this isn't the right place for this. I'm really hoping someone can help.

I've been pouring over the devkitpro forums, the devkitpro examples, the source code for Citro2d and Citro3d, and just all this stuff for days now, trying to solve what seem to be basic problems with some 3DS homebrew I'm trying to make.

The biggest question I have right now is: using Citro2D, how do I "clear" a rectangle on a texture? I'm drawing shapes using the commands such as C2D_DrawRectSolid, etc, and all that stuff works, but all the Citro2D commands appear to be additive blending / compositing. I need to be able to draw a fully transparent rectangle and have it overwrite whatever is on the texture rather than adding on top of it, to create an "erased" section. Note: I don't mean erase the whole texture, just a portion of it. If there wasn't swizzling and whatever else making the texture format in memory awful to work with, I'd just memcopy the rectangle of 0's into the raw data.

Assume I already have all the code set up for creating a vram texture, creating a target to draw into, the screen initialization, and system loop etc. I can provide some example code if needed, but really I just want to know "If I'm at the point where I can draw a rectangle on screen, how do I draw that rectangle as a full replacement, including the alpha channel, rather than blended with whatever is there".


If there's anyone here who has experience with these things, I do have more questions pertaining to weird quirks with off-screen textures/etc. It's just this one thing is completely stopping me from moving forward, and I've been sifting through the citro2d/3d library source code for days now and I'm so tired.
 

haloopdy

New Member
OP
Newbie
Joined
May 29, 2021
Messages
4
Trophies
0
Age
30
XP
25
Country
United States
Hopefully this helps someone: I got my answer from one of the developers of Citro2D. There's a way to set the alpha blending mode using Citro3D (which is designed to be used in conjunction with Citro2D). The post explaining this is here: (I can't post links agh, go google "github citro2d" and click on the issues tab, then look at closed issues and find one talking about clear rectangle)

Basically, if you need to "clear" a rectangle, you can first set the alpha blending to "overwrite", then draw your fully transparent rectangle (or any other shape), then reset the alpha blending back to the original parameters. Just make sure to flush any existing draw commands with C2D_Flush() before the alpha is changed, otherwise it'll apply the new alpha to the old draw calls.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    kenenthk @ kenenthk: Does anything