C2D_DrawRectangle set compositing OR "ClearRectangle" analog

Post Reply
User avatar
haloopdy
Posts: 6
Joined: Tue May 25, 2021 11:21 pm

C2D_DrawRectangle set compositing OR "ClearRectangle" analog

Post by haloopdy » Sat May 29, 2021 1:10 am

I want to preface that I've spent over a dozen hours over the last few days pouring over the devkitpro examples, the Citro2d and Citro3D source code, a bit of libctru, it's been a nightmare. And I get that there's probably nobody here in this forum anymore, that's fine. But I still want to try.

I'm hoping this is simple: I need to change the vertex compositing/whatever you want to call it to full overwrite rather than blending for a couple rectangles. I basically need to just clear out a rectangle (or any other shape for that matter) from a texture, but it appears to only be additive blending, so a full transparent vertex draw yields... well, nothing of course.

I have the source code, but I'm tired of posting into the void. I'll get the proper github commit and all that set up if this post ever makes it through. I also have what I think are several bug reports, or at least gaps in documentation if they're "not bugs".

User avatar
fincs
( ͡° ͜ʖ ͡°)
Posts: 88
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain
Contact:

Re: C2D_DrawRectangle set compositing OR "ClearRectangle" analog

Post by fincs » Sat Jun 05, 2021 12:42 pm

Hi, sorry for taking long to respond. I believe you submitted this question afterwards in the citro2d issue tracker. I'm reposting my answer here, where it really belongs:
fincs wrote: citro3d and citro2d are designed to be usable concurrently. In addition, citro2d does not alter alpha blending state in any way. You're free to use C3D_AlphaBlend to change blending settings as you see fit (it works in the same way as glBlendEquationSeparate + glBlendFuncSeparate). Just make sure to call C2D_Flush before you change it, though.

Code: Select all

// This configures default blending settings
C3D_AlphaBlend(GPU_BLEND_ADD, GPU_BLEND_ADD, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);

// This configures "overwrite" mode
C3D_AlphaBlend(GPU_BLEND_ADD, GPU_BLEND_ADD, GPU_ONE, GPU_ZERO, GPU_ONE, GPU_ZERO);
Donate to devkitPro - help us stay alive!

User avatar
haloopdy
Posts: 6
Joined: Tue May 25, 2021 11:21 pm

Re: C2D_DrawRectangle set compositing OR "ClearRectangle" analog

Post by haloopdy » Sat Jun 05, 2021 5:00 pm

I really really appreciate this one, it's one of the things I spent the longest trying to figure out. Considering how simple it is to do, I feel really stupid that I couldn't figure it out lol.

Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests