Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> | |
4 | <refentry id="glBitmap"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glBitmap</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glBitmap</refname> | |
17 | <refpurpose>draw a bitmap</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glBitmap</function></funcdef> | |
23 | <paramdef>GLsizei <parameter>width</parameter></paramdef> | |
24 | <paramdef>GLsizei <parameter>height</parameter></paramdef> | |
25 | <paramdef>GLfloat <parameter>xorig</parameter></paramdef> | |
26 | <paramdef>GLfloat <parameter>yorig</parameter></paramdef> | |
27 | <paramdef>GLfloat <parameter>xmove</parameter></paramdef> | |
28 | <paramdef>GLfloat <parameter>ymove</parameter></paramdef> | |
29 | <paramdef>const GLubyte * <parameter>bitmap</parameter></paramdef> | |
30 | </funcprototype> | |
31 | </funcsynopsis> | |
32 | </refsynopsisdiv> | |
33 | <!-- eqn: ignoring delim $$ --> | |
34 | <refsect1 id="parameters"><title>Parameters</title> | |
35 | <variablelist> | |
36 | <varlistentry> | |
37 | <term><parameter>width</parameter></term> | |
38 | <term><parameter>height</parameter></term> | |
39 | <listitem> | |
40 | <para> | |
41 | Specify the pixel width and height of the bitmap image. | |
42 | </para> | |
43 | </listitem> | |
44 | </varlistentry> | |
45 | <varlistentry> | |
46 | <term><parameter>xorig</parameter></term> | |
47 | <term><parameter>yorig</parameter></term> | |
48 | <listitem> | |
49 | <para> | |
50 | Specify the location of the origin in the bitmap image. | |
51 | The origin is measured from the lower left corner of the bitmap, | |
52 | with right and up being the positive axes. | |
53 | </para> | |
54 | </listitem> | |
55 | </varlistentry> | |
56 | <varlistentry> | |
57 | <term><parameter>xmove</parameter></term> | |
58 | <term><parameter>ymove</parameter></term> | |
59 | <listitem> | |
60 | <para> | |
61 | Specify the <emphasis>x</emphasis> and <emphasis>y</emphasis> offsets to be added to the current raster position | |
62 | after the bitmap is drawn. | |
63 | </para> | |
64 | </listitem> | |
65 | </varlistentry> | |
66 | <varlistentry> | |
67 | <term><parameter>bitmap</parameter></term> | |
68 | <listitem> | |
69 | <para> | |
70 | Specifies the address of the bitmap image. | |
71 | </para> | |
72 | </listitem> | |
73 | </varlistentry> | |
74 | </variablelist> | |
75 | </refsect1> | |
76 | <refsect1 id="description"><title>Description</title> | |
77 | <para> | |
78 | A bitmap is a binary image. | |
79 | When drawn, | |
80 | the bitmap is positioned relative to the current raster position, | |
81 | and frame buffer pixels corresponding to 1's in the bitmap are | |
82 | written using the current raster color or index. | |
83 | Frame buffer pixels corresponding to 0's in the bitmap are not modified. | |
84 | </para> | |
85 | <para> | |
86 | <function>glBitmap</function> takes seven arguments. | |
87 | The first pair specifies the width and height of the bitmap image. | |
88 | The second pair specifies the location of the bitmap origin relative | |
89 | to the lower left corner of the bitmap image. | |
90 | The third pair of arguments specifies <emphasis>x</emphasis> and <emphasis>y</emphasis> offsets to be added | |
91 | to the current raster position after the bitmap has been drawn. | |
92 | The final argument is a pointer to the bitmap image itself. | |
93 | </para> | |
94 | <para> | |
95 | If a non-zero named buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target | |
96 | (see <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>) while a bitmap image is | |
97 | specified, <parameter>bitmap</parameter> is treated as a byte offset into the buffer object's data store. | |
98 | </para> | |
99 | <para> | |
100 | The bitmap image is interpreted like image data for the <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry> | |
101 | command, | |
102 | with <parameter>width</parameter> and <parameter>height</parameter> corresponding to the width and height arguments | |
103 | of that command, | |
104 | and with <emphasis>type</emphasis> set to <constant>GL_BITMAP</constant> | |
105 | and <emphasis>format</emphasis> set to <constant>GL_COLOR_INDEX</constant>. | |
106 | Modes specified using <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry> affect the | |
107 | interpretation of bitmap image data; | |
108 | modes specified using <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry> do not. | |
109 | </para> | |
110 | <para> | |
111 | If the current raster position is invalid, <function>glBitmap</function> is ignored. | |
112 | Otherwise, | |
113 | the lower left corner of the bitmap image is positioned at the window coordinates | |
114 | </para> | |
115 | <para> | |
116 | <inlineequation><mml:math> | |
117 | <!-- eqn: x sub w = \(lf x sub r - x sub o \(rf:--> | |
118 | <mml:mrow> | |
119 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
120 | <mml:mi mathvariant="italic">w</mml:mi> | |
121 | </mml:msub> | |
122 | <mml:mo>=</mml:mo> | |
123 | <mml:mfenced open="⌊" close="⌋"> | |
124 | <mml:mrow> | |
125 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
126 | <mml:mi mathvariant="italic">r</mml:mi> | |
127 | </mml:msub> | |
128 | <mml:mo>-</mml:mo> | |
129 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
130 | <mml:mi mathvariant="italic">o</mml:mi> | |
131 | </mml:msub> | |
132 | </mml:mrow> | |
133 | </mml:mfenced> | |
134 | </mml:mrow> | |
135 | </mml:math></inlineequation> | |
136 | </para> | |
137 | <para> | |
138 | <inlineequation><mml:math> | |
139 | <!-- eqn: y sub w = \(lf y sub r - y sub o \(rf:--> | |
140 | <mml:mrow> | |
141 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
142 | <mml:mi mathvariant="italic">w</mml:mi> | |
143 | </mml:msub> | |
144 | <mml:mo>=</mml:mo> | |
145 | <mml:mfenced open="⌊" close="⌋"> | |
146 | <mml:mrow> | |
147 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
148 | <mml:mi mathvariant="italic">r</mml:mi> | |
149 | </mml:msub> | |
150 | <mml:mo>-</mml:mo> | |
151 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
152 | <mml:mi mathvariant="italic">o</mml:mi> | |
153 | </mml:msub> | |
154 | </mml:mrow> | |
155 | </mml:mfenced> | |
156 | </mml:mrow> | |
157 | </mml:math></inlineequation> | |
158 | </para> | |
159 | <para> | |
160 | where | |
161 | <inlineequation><mml:math> | |
162 | <!-- eqn: ( x sub r , y sub r ):--> | |
163 | <mml:mfenced open="(" close=")"> | |
164 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
165 | <mml:mi mathvariant="italic">r</mml:mi> | |
166 | </mml:msub> | |
167 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
168 | <mml:mi mathvariant="italic">r</mml:mi> | |
169 | </mml:msub> | |
170 | </mml:mfenced> | |
171 | </mml:math></inlineequation> | |
172 | is the raster position | |
173 | and | |
174 | <inlineequation><mml:math> | |
175 | <!-- eqn: ( x sub o , y sub o ):--> | |
176 | <mml:mfenced open="(" close=")"> | |
177 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
178 | <mml:mi mathvariant="italic">o</mml:mi> | |
179 | </mml:msub> | |
180 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
181 | <mml:mi mathvariant="italic">o</mml:mi> | |
182 | </mml:msub> | |
183 | </mml:mfenced> | |
184 | </mml:math></inlineequation> | |
185 | is the bitmap origin. | |
186 | Fragments are then generated for each pixel corresponding to a 1 (one) | |
187 | in the bitmap image. | |
188 | These fragments are generated using the current raster <emphasis>z</emphasis> coordinate, | |
189 | color or color index, and current raster texture coordinates. | |
190 | They are then treated just as if they had been generated | |
191 | by a point, line, or polygon, | |
192 | including texture mapping, | |
193 | fogging, | |
194 | and all per-fragment operations such as alpha and depth testing. | |
195 | </para> | |
196 | <para> | |
197 | After the bitmap has been drawn, | |
198 | the <emphasis>x</emphasis> and <emphasis>y</emphasis> coordinates of the current raster position are offset by | |
199 | <parameter>xmove</parameter> and <parameter>ymove</parameter>. | |
200 | No change is made to the <emphasis>z</emphasis> coordinate of the current raster position, | |
201 | or to the current raster color, texture coordinates, or index. | |
202 | </para> | |
203 | </refsect1> | |
204 | <refsect1 id="notes"><title>Notes</title> | |
205 | <para> | |
206 | To set a valid raster position outside the viewport, first set a valid | |
207 | raster position inside the viewport, then call <function>glBitmap</function> with NULL | |
208 | as the <parameter>bitmap</parameter> parameter and with <parameter>xmove</parameter> and <parameter>ymove</parameter> set to | |
209 | the offsets of the new raster position. This technique is useful when | |
210 | panning an image around the viewport. | |
211 | </para> | |
212 | </refsect1> | |
213 | <refsect1 id="errors"><title>Errors</title> | |
214 | <para> | |
215 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> or <parameter>height</parameter> is negative. | |
216 | </para> | |
217 | <para> | |
218 | <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the | |
219 | <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the buffer object's data store is currently mapped. | |
220 | </para> | |
221 | <para> | |
222 | <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the | |
223 | <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the data would be unpacked from the buffer | |
224 | object such that the memory reads required would exceed the data store size. | |
225 | </para> | |
226 | <para> | |
227 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glBitmap</function> | |
228 | is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding execution of | |
229 | <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
230 | </para> | |
231 | </refsect1> | |
232 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
233 | <para> | |
234 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_POSITION</constant> | |
235 | </para> | |
236 | <para> | |
237 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_COLOR</constant> | |
238 | </para> | |
239 | <para> | |
240 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_SECONDARY_COLOR</constant> | |
241 | </para> | |
242 | <para> | |
243 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_DISTANCE</constant> | |
244 | </para> | |
245 | <para> | |
246 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_INDEX</constant> | |
247 | </para> | |
248 | <para> | |
249 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_TEXTURE_COORDS</constant> | |
250 | </para> | |
251 | <para> | |
252 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_POSITION_VALID</constant> | |
253 | </para> | |
254 | <para> | |
255 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant> | |
256 | </para> | |
257 | </refsect1> | |
258 | <refsect1 id="seealso"><title>See Also</title> | |
259 | <para> | |
260 | <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>, | |
261 | <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>, | |
262 | <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>, | |
263 | <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>, | |
264 | <citerefentry><refentrytitle>glRasterPos</refentrytitle></citerefentry>, | |
265 | <citerefentry><refentrytitle>glWindowPos</refentrytitle></citerefentry> | |
266 | </para> | |
267 | </refsect1> | |
268 | <refsect1 id="Copyright"><title>Copyright</title> | |
269 | <para> | |
270 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
271 | Silicon Graphics, Inc. This document is licensed under the SGI | |
272 | Free Software B License. For details, see | |
273 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
274 | </para> | |
275 | </refsect1> | |
276 | </refentry> |