{
  "name": "@exercise/blend-basics",
  "version": "1.0.0",
  "main": "server.js",
  "dependencies": {},
  "scripts": {
    "start": "node server.js"
  },
  "readme": "# Exercise\n\nDraw 4 overlapping rectangles with additive blending and the weight `gl.SRC_ALPHA` for the source fragment and `gl.ONE_MINUS_SRC_ALPHA` for the destination fragment.\n\n# Blending\n\nIn WebGL, blending combines the contents of the currently rendered fragment with the color value stored in the drawing buffer to compute a new color value.\n\nBy convention, the fragment being drawn is called the *source* and the fragment in the drawing buffer is called the *destination*.\n\nBy default, the new fragment color is just the source color, however if we turn on blending:\n\n```javascript\ngl.enable(gl.BLEND)\n```\n\nThen the color of the resulting fragment is computed as a weighted combination of the source and destination fragments. To specify these weights, we can use the following command:\n\n#### `gl.blendFuncSeparate(sourceRGB, sourceAlpha, destRGB, destAlpha)`\n\nEach of the parameter `sourceRGB`, `sourceAlpha`, `destRGB`, `destAlpha` describes the weight which is applied to either the source or destination fragment.  The possible values for these weights are as follows:\n\n* `gl.ZERO`: (0,0,0,0)\n* `gl.ONE`: (1,1,1,1)\n* `gl.SRC_COLOR`: (Rs, Gs, Bs, As)\n* `gl.ONE_MINUS_SRC_COLOR`: (1,1,1,1)−(Rs,Gs,Bs,As)\n* `gl.DST_COLOR`: (Rd, Gd, Bd, Ad)\n* `gl.ONE_MINUS_DST_COLOR`: (1,1,1,1)−(Rd,Gd,Bd,Ad)\n* `gl.SRC_ALPHA`: (As, As, As, As)\n* `gl.ONE_MINUS_SRC_ALPHA`: (1,1,1,1)−(As,As,As,As)\n* `gl.DST_ALPHA`: (Ad, Ad, Ad, Ad)\n* `gl.ONE_MINUS_DST_ALPHA`: (1,1,1,1)−(Ad,Ad,Ad,Ad)\n\nBy convention, (Rs, Gs, Bs, As) are the components of the source color and (Rd, Gd, Bd, Ad) are the components of the destination color.\n\nThere are also `gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_ALPHA` and `gl.SRC_ALPHA_SATURATE`, but don't worry about them for now.\n\nIn addition to the above blend functions, you can also change how the \n\n#### `gl.blendEquationSeparate(modeRGB, modeAlpha)`\n\n`modeRGB` and `modeAlpha` control the two different ways of \n\n* `gl.FUNC_ADD`\n* `gl.FUNC_SUBTRACT`\n* `gl.FUNC_REVERSE_SUBTRACT`\n\n",
  "readmeFilename": "README.md",
  "description": "Draw 4 overlapping rectangles with additive blending and the weight `gl.SRC_ALPHA` for the source fragment and `gl.ONE_MINUS_SRC_ALPHA` for the destination fragment.",
  "_id": "@exercise/blend-basics@1.0.0",
  "_shasum": "6d350ad1798d0bb2d4dc5ca17f97ade45249f5dd",
  "_from": "exercises/blend-basics",
  "_resolved": "file:exercises/blend-basics"
}
