Hello and apologies for what must surely be a beginner mistake.
I have two images, taken from Anders Riggelsen’s Blend Equations site:
In my 2D Opengl engine, I do the following (it’s in lua but you get the idea):
DrawSprite(flamingobg,0,500,300) GPUSetBlendFunc(BM_1M_SRC_COLOR, BM_1M_SRC_COLOR) DrawSprite(flamingos,0,500,300) GPUSetBlendFunc(BM_SRC_ALPHA,BM_1M_SRC_ALPHA)
And I get this result: <= THIS IS WHAT I WANT TO FIX!
Essentially, the “hidden” transparent parts of the foreground image are now visible.
However, both in Anders’ website and in GameMaker studio, using the exact equivalent functions, I get this:
So my question is whether there is some opengl setting I have omitted.
When I use
(ie the “default” alpha blending mode), the result is pretty much the expected one:
Lastly, depth testing is disabled, blending is enabled, and my fragment shader is your basic “passthrough” shader:
FragColor = vColor * texture(baseTex,TexCoord);
I would really appreciate some input in this!