-
Notifications
You must be signed in to change notification settings - Fork 94
/
glColor.xhtml
82 lines (80 loc) · 15.7 KB
/
glColor.xhtml
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
<div class="refentry" lang="en" xml:lang="en"><a id="glColor"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glColor — set the current color</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3b</b>(</code></td><td>GLbyte </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLbyte </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLbyte </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3s</b>(</code></td><td>GLshort </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLshort </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLshort </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3i</b>(</code></td><td>GLint </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3f</b>(</code></td><td>GLfloat </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3d</b>(</code></td><td>GLdouble </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3ub</b>(</code></td><td>GLubyte </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLubyte </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLubyte </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3us</b>(</code></td><td>GLushort </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLushort </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLushort </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3ui</b>(</code></td><td>GLuint </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">blue</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4b</b>(</code></td><td>GLbyte </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLbyte </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLbyte </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLbyte </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4s</b>(</code></td><td>GLshort </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLshort </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLshort </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLshort </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4i</b>(</code></td><td>GLint </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4f</b>(</code></td><td>GLfloat </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4d</b>(</code></td><td>GLdouble </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4ub</b>(</code></td><td>GLubyte </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLubyte </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLubyte </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLubyte </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4us</b>(</code></td><td>GLushort </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLushort </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLushort </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLushort </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4ui</b>(</code></td><td>GLuint </td><td><var class="pdparam">red</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">green</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">blue</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">alpha</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>red</code></em>, </span><span class="term"><em class="parameter"><code>green</code></em>, </span><span class="term"><em class="parameter"><code>blue</code></em></span></dt><dd><p>
Specify new red, green, and blue values for the current color.
</p></dd><dt><span class="term"><em class="parameter"><code>alpha</code></em></span></dt><dd><p>
Specifies a new alpha value for the current color.
Included only in the four-argument <code class="function">glColor4</code> commands.
</p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3bv</b>(</code></td><td>const GLbyte * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3sv</b>(</code></td><td>const GLshort * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3iv</b>(</code></td><td>const GLint * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3fv</b>(</code></td><td>const GLfloat * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3dv</b>(</code></td><td>const GLdouble * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3ubv</b>(</code></td><td>const GLubyte * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3usv</b>(</code></td><td>const GLushort * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor3uiv</b>(</code></td><td>const GLuint * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4bv</b>(</code></td><td>const GLbyte * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4sv</b>(</code></td><td>const GLshort * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4iv</b>(</code></td><td>const GLint * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4fv</b>(</code></td><td>const GLfloat * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4dv</b>(</code></td><td>const GLdouble * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4ubv</b>(</code></td><td>const GLubyte * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4usv</b>(</code></td><td>const GLushort * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glColor4uiv</b>(</code></td><td>const GLuint * </td><td><var class="pdparam">v</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>v</code></em></span></dt><dd><p>
Specifies a pointer to an array that contains red, green, blue,
and (sometimes) alpha values.
</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
The GL stores both a current single-valued color index
and a current four-valued RGBA color.
<code class="function">glColor</code> sets a new four-valued RGBA color.
<code class="function">glColor</code> has two major variants:
<code class="function">glColor3</code> and <code class="function">glColor4</code>.
<code class="function">glColor3</code> variants specify new red,
green,
and blue values explicitly
and set the current alpha value to 1.0 (full intensity) implicitly.
<code class="function">glColor4</code> variants specify all four color components explicitly.
</p><p>
<code class="function">glColor3b</code>, <code class="function">glColor4b</code>,
<code class="function">glColor3s</code>, <code class="function">glColor4s</code>, <code class="function">glColor3i</code>, and <code class="function">glColor4i</code> take
three or four signed byte, short, or long integers as arguments.
When <span class="bold"><strong>v</strong></span> is appended to the name,
the color commands can take a pointer to an array of such values.
</p><p>
Current color values are stored in floating-point format,
with unspecified mantissa and exponent sizes.
Unsigned integer color components,
when specified,
are linearly mapped to floating-point values such that the largest
representable value maps to 1.0 (full intensity),
and 0 maps to 0.0 (zero intensity).
Signed integer color components,
when specified,
are linearly mapped to floating-point values such that the most positive
representable value maps to 1.0,
and the most negative representable value maps to
<math overflow="scroll">
<mn>-1.0</mn>
</math>.
(Note that
this mapping does not convert 0 precisely to 0.0.)
Floating-point values are mapped directly.
</p><p>
Neither floating-point nor signed integer values are clamped
to the range
<math overflow="scroll">
<mfenced open="[" close="]">
<mn>0</mn>
<mn>1</mn>
</mfenced>
</math>
before the current color is updated.
However,
color components are clamped to this range before they are interpolated
or written into a color buffer.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
The initial value for the current color is (1, 1, 1, 1).
</p><p>
The current color can be updated at any time.
In particular,
<code class="function">glColor</code> can be called between a call to <a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding
call to <a class="citerefentry" href="glEnd"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_COLOR</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_RGBA_MODE</code>
</p></div>
{$pipelinestall}{$examples}
<div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
<code class="function">glColorPointer</code>,
<a class="citerefentry" href="glIndex"><span class="citerefentry"><span class="refentrytitle">glIndex</span></span></a>,
<a class="citerefentry" href="glSecondaryColor"><span class="citerefentry"><span class="refentrytitle">glSecondaryColor</span></span></a>
</p></div><div class="refsect1" lang="en" xml:lang="en"><div id="Copyright"><h2>Copyright</h2><p>
Copyright © 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
</p></div></div></div>