Blending Two Colours

Hi Everyone,

First post here so please be gentle :smiley:

I have a routine which draws a checked board to the screen. I have implemented this from a photoshop mockup which has the following layers


Checker

Checker Base

Base Texture

I have the base texture rendering correctly. I then iterate through my checkers and draw one “checker base” quad and a “checker” quad.

The “checker base” is the same size/position it just acts as an underlay to the “checker”.

The “checker base” has RGBA (1.0, 1.0, 1.0, 0.2) so white with 20% transparency.

Whilst the “checker” is either (r, g, b, 0.2) or (r, g, b, 0.8) depending on whether it is odd or even.

Current blending is: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

Basically I want to optimize the above into one draw for each checker as opposed to two.

How do I go about calculating the colour of the two merged quads “checker” and “checker base” ?

Not sure if this is what you are looking for, but the OpenGL blending calculations are described on the man page for glBlendFunc.