Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 8f7fbb2

Browse filesBrowse files
committed
[[ Blend Modes ]] Support some blend modes in openGL compositor
1 parent 35b5848 commit 8f7fbb2
Copy full SHA for 8f7fbb2

File tree

1 file changed

+62
-0
lines changed
Filter options

1 file changed

+62
-0
lines changed

‎engine/src/tilecachegl.cpp

Copy file name to clipboardExpand all lines: engine/src/tilecachegl.cpp
+62Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,68 @@ bool MCTileCacheOpenGLCompositor_BeginLayer(void *p_context, const MCRectangle&
555555
self -> is_blending = true;
556556
glEnable(GL_BLEND);
557557
}
558+
559+
switch(p_ink)
560+
{
561+
case GXblendClear:
562+
case GXclear:
563+
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
564+
break;
565+
case GXblendSrc:
566+
glBlendFunc(GL_ONE, GL_ZERO);
567+
break;
568+
case GXblendDst:
569+
glBlendFunc(GL_ZERO, GL_ONE);
570+
break;
571+
case GXblendSrcOver:
572+
case GXcopy:
573+
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
574+
break;
575+
case GXblendDstOver:
576+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
577+
break;
578+
case GXblendSrcIn:
579+
glBlendFunc(GL_DST_ALPHA, GL_ZERO);
580+
break;
581+
case GXblendDstIn:
582+
glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
583+
break;
584+
case GXblendSrcOut:
585+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
586+
break;
587+
case GXblendDstOut:
588+
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
589+
break;
590+
case GXblendSrcAtop:
591+
glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
592+
break;
593+
case GXblendDstAtop:
594+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
595+
break;
596+
case GXblendXor:
597+
case GXxor:
598+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
599+
break;
600+
case GXblendPlus:
601+
glBlendFunc(GL_ONE, GL_ONE);
602+
break;
603+
case GXblendScreen:
604+
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
605+
break;
606+
case GXblendMultiply:
607+
case GXblendOverlay:
608+
case GXblendDarken:
609+
case GXblendLighten:
610+
case GXblendDodge:
611+
case GXblendBurn:
612+
case GXblendSoftLight:
613+
case GXblendHardLight:
614+
case GXblendDifference:
615+
case GXblendExclusion:
616+
default:
617+
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
618+
break;
619+
}
558620

559621
self -> current_opacity = p_opacity;
560622

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.