/usr/share/gtk-doc/html/cogl/cogl-Blend-Strings.html is in libcogl-doc 1.10.0-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Material Blend Strings</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Cogl Reference Manual">
<link rel="up" href="ch01.html" title="Cogl - a modern 3D graphics API">
<link rel="prev" href="cogl-Textures.html" title="Textures">
<link rel="next" href="cogl-Materials.html" title="Materials">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="cogl-Textures.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cogl Reference Manual</th>
<td><a accesskey="n" href="cogl-Materials.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
|
<a href="#cogl-Blend-Strings.description" class="shortcut">Cogl Blend Strings</a>
</td></tr>
</table>
<div class="refentry">
<a name="cogl-Blend-Strings"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cogl-Blend-Strings.top_of_page"></a>Material Blend Strings</span></h2>
<p>Material Blend Strings — A simple syntax and grammar for describing blending and texture
combining functions.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="cogl-Blend-Strings.description"></a><h2>Cogl Blend Strings</h2>
<p>
Describing GPU blending and texture combining states is rather awkward to do
in a consise but also readable fashion. Cogl helps by supporting
string based descriptions using a simple syntax.
</p>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="idp8607008"></a>Some examples</h4></div></div></div>
<p>Here is an example used for blending:</p>
<pre class="programlisting">
"RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))"
</pre>
<p>In OpenGL terms this replaces glBlendFunc[Separate] and
glBlendEquation[Separate]</p>
<p>
Actually in this case it's more verbose than the GL equivalent:
</p>
<pre class="programlisting">
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
</pre>
<p>
But unless you are familiar with OpenGL or refer to its API documentation
you wouldn't know that the default function used by OpenGL is GL_FUNC_ADD
nor would you know that the above arguments determine what the source color
and destination color will be multiplied by before being adding.
</p>
<p>Here is an example used for texture combining:</p>
<pre class="programlisting">
"RGB = REPLACE (PREVIOUS)"
"A = MODULATE (PREVIOUS, TEXTURE)"
</pre>
<p>
In OpenGL terms this replaces glTexEnv, and the above example is equivalent
to this OpenGL code:
</p>
<pre class="programlisting">
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR);
glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR);
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="cogl-Blend-String-syntax"></a>Here's the syntax</h4></div></div></div>
<pre class="programlisting">
<statement>:
<channel-mask>=<function-name>(<arg-list>)
You can either use a single statement with an RGBA channel-mask or you can use
two statements; one with an A channel-mask and the other with an RGB
channel-mask.
<channel-mask>:
A or RGB or RGBA
<function-name>:
[A-Za-z_]*
<arg-list>:
<arg>,<arg>
or <arg>
or ""
I.e. functions may take 0 or more arguments
<arg>:
<color-source>
1 - <color-source> : Only intended for texture combining
<color-source> * ( <factor> ) : Only intended for blending
0 : Only intended for blending
See the blending or texture combining sections for further notes and examples.
<color-source>:
<source-name>[<channel-mask>]
<source-name>
See the blending or texture combining sections for the list of source-names
valid in each context.
If a channel mask is not given then the channel mask of the statement
is assumed instead.
<factor>:
0
1
<color-source>
1-<color-source>
SRC_ALPHA_SATURATE
</pre>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.18</div>
</body>
</html>
|