Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glBitmap</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glBitmap"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glBitmap — draw a bitmap</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glBitmap</b>(</code></td><td>GLsizei </td><td><var class="pdparam">width</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">height</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">xorig</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">yorig</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">xmove</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">ymove</var>, </td></tr><tr><td> </td><td>const GLubyte * </td><td><var class="pdparam">bitmap</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>width</code></em>, </span><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p> | |
4 | Specify the pixel width and height of the bitmap image. | |
5 | </p></dd><dt><span class="term"><em class="parameter"><code>xorig</code></em>, </span><span class="term"><em class="parameter"><code>yorig</code></em></span></dt><dd><p> | |
6 | Specify the location of the origin in the bitmap image. | |
7 | The origin is measured from the lower left corner of the bitmap, | |
8 | with right and up being the positive axes. | |
9 | </p></dd><dt><span class="term"><em class="parameter"><code>xmove</code></em>, </span><span class="term"><em class="parameter"><code>ymove</code></em></span></dt><dd><p> | |
10 | Specify the <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span> offsets to be added to the current raster position | |
11 | after the bitmap is drawn. | |
12 | </p></dd><dt><span class="term"><em class="parameter"><code>bitmap</code></em></span></dt><dd><p> | |
13 | Specifies the address of the bitmap image. | |
14 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
15 | A bitmap is a binary image. | |
16 | When drawn, | |
17 | the bitmap is positioned relative to the current raster position, | |
18 | and frame buffer pixels corresponding to 1's in the bitmap are | |
19 | written using the current raster color or index. | |
20 | Frame buffer pixels corresponding to 0's in the bitmap are not modified. | |
21 | </p><p> | |
22 | <code class="function">glBitmap</code> takes seven arguments. | |
23 | The first pair specifies the width and height of the bitmap image. | |
24 | The second pair specifies the location of the bitmap origin relative | |
25 | to the lower left corner of the bitmap image. | |
26 | The third pair of arguments specifies <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span> offsets to be added | |
27 | to the current raster position after the bitmap has been drawn. | |
28 | The final argument is a pointer to the bitmap image itself. | |
29 | </p><p> | |
30 | If a non-zero named buffer object is bound to the <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target | |
31 | (see <a class="citerefentry" href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>) while a bitmap image is | |
32 | specified, <em class="parameter"><code>bitmap</code></em> is treated as a byte offset into the buffer object's data store. | |
33 | </p><p> | |
34 | The bitmap image is interpreted like image data for the <a class="citerefentry" href="glDrawPixels.xml"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a> | |
35 | command, | |
36 | with <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> corresponding to the width and height arguments | |
37 | of that command, | |
38 | and with <span class="emphasis"><em>type</em></span> set to <code class="constant">GL_BITMAP</code> | |
39 | and <span class="emphasis"><em>format</em></span> set to <code class="constant">GL_COLOR_INDEX</code>. | |
40 | Modes specified using <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> affect the | |
41 | interpretation of bitmap image data; | |
42 | modes specified using <a class="citerefentry" href="glPixelTransfer.xml"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a> do not. | |
43 | </p><p> | |
44 | If the current raster position is invalid, <code class="function">glBitmap</code> is ignored. | |
45 | Otherwise, | |
46 | the lower left corner of the bitmap image is positioned at the window coordinates | |
47 | </p><p> | |
48 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
49 | ||
50 | <mml:mrow> | |
51 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
52 | <mml:mi mathvariant="italic">w</mml:mi> | |
53 | </mml:msub> | |
54 | <mml:mo>=</mml:mo> | |
55 | <mml:mfenced open="⌊" close="⌋"> | |
56 | <mml:mrow> | |
57 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
58 | <mml:mi mathvariant="italic">r</mml:mi> | |
59 | </mml:msub> | |
60 | <mml:mo>-</mml:mo> | |
61 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
62 | <mml:mi mathvariant="italic">o</mml:mi> | |
63 | </mml:msub> | |
64 | </mml:mrow> | |
65 | </mml:mfenced> | |
66 | </mml:mrow> | |
67 | </mml:math> | |
68 | </p><p> | |
69 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
70 | ||
71 | <mml:mrow> | |
72 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
73 | <mml:mi mathvariant="italic">w</mml:mi> | |
74 | </mml:msub> | |
75 | <mml:mo>=</mml:mo> | |
76 | <mml:mfenced open="⌊" close="⌋"> | |
77 | <mml:mrow> | |
78 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
79 | <mml:mi mathvariant="italic">r</mml:mi> | |
80 | </mml:msub> | |
81 | <mml:mo>-</mml:mo> | |
82 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
83 | <mml:mi mathvariant="italic">o</mml:mi> | |
84 | </mml:msub> | |
85 | </mml:mrow> | |
86 | </mml:mfenced> | |
87 | </mml:mrow> | |
88 | </mml:math> | |
89 | </p><p> | |
90 | where | |
91 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
92 | ||
93 | <mml:mfenced open="(" close=")"> | |
94 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
95 | <mml:mi mathvariant="italic">r</mml:mi> | |
96 | </mml:msub> | |
97 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
98 | <mml:mi mathvariant="italic">r</mml:mi> | |
99 | </mml:msub> | |
100 | </mml:mfenced> | |
101 | </mml:math> | |
102 | is the raster position | |
103 | and | |
104 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
105 | ||
106 | <mml:mfenced open="(" close=")"> | |
107 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
108 | <mml:mi mathvariant="italic">o</mml:mi> | |
109 | </mml:msub> | |
110 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
111 | <mml:mi mathvariant="italic">o</mml:mi> | |
112 | </mml:msub> | |
113 | </mml:mfenced> | |
114 | </mml:math> | |
115 | is the bitmap origin. | |
116 | Fragments are then generated for each pixel corresponding to a 1 (one) | |
117 | in the bitmap image. | |
118 | These fragments are generated using the current raster <span class="emphasis"><em>z</em></span> coordinate, | |
119 | color or color index, and current raster texture coordinates. | |
120 | They are then treated just as if they had been generated | |
121 | by a point, line, or polygon, | |
122 | including texture mapping, | |
123 | fogging, | |
124 | and all per-fragment operations such as alpha and depth testing. | |
125 | </p><p> | |
126 | After the bitmap has been drawn, | |
127 | the <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span> coordinates of the current raster position are offset by | |
128 | <em class="parameter"><code>xmove</code></em> and <em class="parameter"><code>ymove</code></em>. | |
129 | No change is made to the <span class="emphasis"><em>z</em></span> coordinate of the current raster position, | |
130 | or to the current raster color, texture coordinates, or index. | |
131 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
132 | To set a valid raster position outside the viewport, first set a valid | |
133 | raster position inside the viewport, then call <code class="function">glBitmap</code> with NULL | |
134 | as the <em class="parameter"><code>bitmap</code></em> parameter and with <em class="parameter"><code>xmove</code></em> and <em class="parameter"><code>ymove</code></em> set to | |
135 | the offsets of the new raster position. This technique is useful when | |
136 | panning an image around the viewport. | |
137 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
138 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> is negative. | |
139 | </p><p> | |
140 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the | |
141 | <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the buffer object's data store is currently mapped. | |
142 | </p><p> | |
143 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the | |
144 | <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the data would be unpacked from the buffer | |
145 | object such that the memory reads required would exceed the data store size. | |
146 | </p><p> | |
147 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glBitmap</code> | |
148 | is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding execution of | |
149 | <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
150 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
151 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_POSITION</code> | |
152 | </p><p> | |
153 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_COLOR</code> | |
154 | </p><p> | |
155 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_SECONDARY_COLOR</code> | |
156 | </p><p> | |
157 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_DISTANCE</code> | |
158 | </p><p> | |
159 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_INDEX</code> | |
160 | </p><p> | |
161 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_TEXTURE_COORDS</code> | |
162 | </p><p> | |
163 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_POSITION_VALID</code> | |
164 | </p><p> | |
165 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_UNPACK_BUFFER_BINDING</code> | |
166 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
167 | <a class="citerefentry" href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>, | |
168 | <a class="citerefentry" href="glDrawPixels.xml"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>, | |
169 | <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>, | |
170 | <a class="citerefentry" href="glPixelTransfer.xml"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>, | |
171 | <a class="citerefentry" href="glRasterPos.xml"><span class="citerefentry"><span class="refentrytitle">glRasterPos</span></span></a>, | |
172 | <a class="citerefentry" href="glWindowPos.xml"><span class="citerefentry"><span class="refentrytitle">glWindowPos</span></span></a> | |
173 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
174 | Copyright <span class="trademark"></span>© 1991-2006 | |
175 | Silicon Graphics, Inc. This document is licensed under the SGI | |
176 | Free Software B License. For details, see | |
177 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
178 | </p></div></div></body></html> |