1GLTEXIMAGE1D(3G) GLTEXIMAGE1D(3G)
2
3
4
6 glTexImage1D - specify a one-dimensional texture image
7
8
10 void glTexImage1D( GLenum target,
11 GLint level,
12 GLint internalFormat,
13 GLsizei width,
14 GLint border,
15 GLenum format,
16 GLenum type,
17 const GLvoid *pixels )
18
19
21 target Specifies the target texture. Must be GL_TEXTURE_1D or
22 GL_PROXY_TEXTURE_1D.
23
24 level Specifies the level-of-detail number. Level 0 is the
25 base image level. Level n is the nth mipmap reduction
26 image.
27
28 internalFormat Specifies the number of color components in the tex‐
29 ture. Must be 1, 2, 3, or 4, or one of the following
30 symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8,
31 GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4,
32 GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16,
33 GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4,
34 GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8,
35 GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12,
36 GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4,
37 GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_RGB,
38 GL_R3_G3_B2, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10,
39 GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4,
40 GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or
41 GL_RGBA16.
42
43 width Specifies the width of the texture image. Must be
44 2n+2(border) for some integer n. All implementations
45 support texture images that are at least 64 texels
46 wide. The height of the 1D texture image is 1.
47
48 border Specifies the width of the border. Must be either 0 or
49 1.
50
51 format Specifies the of the pixel data. The following sym‐
52 bolic values are accepted: GL_COLOR_INDEX, GL_RED,
53 GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_BGR, GL_RGBA,
54 GL_BGRA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.
55
56 type Specifies the data type of the pixel data. The follow‐
57 ing symbolic values are accepted: GL_UNSIGNED_BYTE,
58 GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT,
59 GL_UNSIGNED_INT, GL_INT, GL_FLOAT,
60 GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
61 GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
62 GL_UNSIGNED_SHORT_4_4_4_4,
63 GL_UNSIGNED_SHORT_4_4_4_4_REV,
64 GL_UNSIGNED_SHORT_5_5_5_1,
65 GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
66 GL_UNSIGNED_INT_8_8_8_8_REV,
67 GL_UNSIGNED_INT_10_10_10_2, and
68 GL_UNSIGNED_INT_2_10_10_10_REV.
69
70 pixels Specifies a pointer to the image data in memory.
71
73 Texturing maps a portion of a specified texture image onto each graphi‐
74 cal primitive for which texturing is enabled. To enable and disable
75 one-dimensional texturing, call glEnable and glDisable with argument
76 GL_TEXTURE_1D.
77
78 Texture images are defined with glTexImage1D. The arguments describe
79 the parameters of the texture image, such as width, width of the bor‐
80 der, level-of-detail number (see glTexParameter), and the internal res‐
81 olution and used to store the image. The last three arguments
82 describe how the image is represented in memory; they are identical to
83 the pixel formats used for glDrawPixels.
84
85 If target is GL_PROXY_TEXTURE_1D, no data is read from pixels, but all
86 of the texture image state is recalculated, checked for consistency,
87 and checked against the implementation's capabilities. If the imple‐
88 mentation cannot handle a texture of the requested texture size, it
89 sets all of the image state to 0, but does not generate an error (see
90 glGetError). To query for an entire mipmap array, use an image array
91 level greater than or equal to 1.
92
93 If target is GL_TEXTURE_1D, data is read from pixels as a sequence of
94 signed or unsigned bytes, shorts, or longs, or single-precision float‐
95 ing-point values, depending on type. These values are grouped into
96 sets of one, two, three, or four values, depending on format, to form
97 elements. If type is GL_BITMAP, the data is considered as a string of
98 unsigned bytes (and format must be GL_COLOR_INDEX). Each data byte is
99 treated as eight 1-bit elements, with bit ordering determined by
100 GL_UNPACK_LSB_FIRST (see glPixelStore).
101
102 The first element corresponds to the left end of the texture array.
103 Subsequent elements progress left-to-right through the remaining texels
104 in the texture array. The final element corresponds to the right end
105 of the texture array.
106
107 format determines the composition of each element in pixels. It can
108 assume one of eleven symbolic values:
109
110 GL_COLOR_INDEX
111 Each element is a single value, a color index. The GL con‐
112 verts it to fixed point (with an unspecified number of zero
113 bits to the right of the binary point), shifted left or right
114 depending on the value and sign of GL_INDEX_SHIFT, and added
115 to GL_INDEX_OFFSET (see glPixelTransfer). The resulting
116 index is converted to a set of color components using the
117 GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G,
118 GL_PIXEL_MAP_I_TO_B, and GL_PIXEL_MAP_I_TO_A tables, and
119 clamped to the range [0,1].
120
121 GL_RED Each element is a single red component. The GL converts it
122 to floating point and assembles it into an RGBA element by
123 attaching 0 for green and blue, and 1 for alpha. Each compo‐
124 nent is then multiplied by the signed scale factor
125 GL_c_SCALE, added to the signed bias GL_c_BIAS. and clamped
126 to the range [0,1] (see glPixelTransfer).
127
128 GL_GREEN Each element is a single green component. The GL converts it
129 to floating point and assembles it into an RGBA element by
130 attaching 0 for red and blue, and 1 for alpha. Each compo‐
131 nent is then multiplied by the signed scale factor
132 GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped
133 to the range [0,1] (see glPixelTransfer).
134
135 GL_BLUE Each element is a single blue component. The GL converts it
136 to floating point and assembles it into an RGBA element by
137 attaching 0 for red and green, and 1 for alpha. Each compo‐
138 nent is then multiplied by the signed scale factor
139 GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped
140 to the range [0,1] (see glPixelTransfer).
141
142 GL_ALPHA Each element is a single alpha component. The GL converts it
143 to floating point and assembles it into an RGBA element by
144 attaching 0 for red, green, and blue. Each component is then
145 multiplied by the signed scale factor GL_c_SCALE, added to
146 the signed bias GL_c_BIAS, and clamped to the range [0,1]
147 (see glPixelTransfer).
148
149 GL_RGB
150
151 GL_BGR Each element is an RGB triple. The GL converts it to float‐
152 ing point and assembles it into an RGBA element by attaching
153 1 for alpha. Each component is then multiplied by the signed
154 scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS,
155 and clamped to the range [0,1] (see glPixelTransfer).
156
157 GL_RGBA
158
159 GL_BGRA Each element contains all four components. Each component is
160 then multiplied by the signed scale factor GL_c_SCALE, added
161 to the signed bias GL_c_BIAS, and clamped to the range [0,1]
162 (see glPixelTransfer).
163
164 GL_LUMINANCE
165 Each element is a single luminance value. The GL converts it
166 to floating point, then assembles it into an RGBA element by
167 replicating the luminance value three times for red, green,
168 and blue and attaching 1 for alpha. Each component is then
169 multiplied by the signed scale factor GL_c_SCALE, added to
170 the signed bias GL_c_BIAS, and clamped to the range [0,1]
171 (see glPixelTransfer).
172
173 GL_LUMINANCE_ALPHA
174 Each element is a luminance/alpha pair. The GL converts it
175 to floating point, then assembles it into an RGBA element by
176 replicating the luminance value three times for red, green,
177 and blue. Each component is then multiplied by the signed
178 scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS,
179 and clamped to the range [0,1] (see glPixelTransfer).
180
181 If an application wants to store the texture at a certain resolution or
182 in a certain , it can request the resolution and with internalFormat.
183 The GL will choose an internal representation that closely approximates
184 that requested by internalFormat, but it may not match exactly. (The
185 representations specified by GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB,
186 and GL_RGBA must match exactly. The numeric values 1, 2, 3, and 4 may
187 also be used to specify the preceding representations.)
188
189 Use the GL_PROXY_TEXTURE_1D target to try out a resolution and update
190 and recompute its best match for the requested storage resolution and .
191 To query this state, call glGetTexLevelParameter. If the texture can‐
192 not be accommodated, texture state is set to 0.
193
194 A one-component texture image uses only the red component of the RGBA
195 color from pixels. A two-component image uses the R and A values. A
196 three-component image uses the R, G, and B values. A four-component
197 image uses all of the RGBA components.
198
200 Texturing has no effect in color index mode.
201
202 If the GL_ARB_imaging extension is supported, RGBA elements may also be
203 processed by the imaging pipeline. The following stages may be applied
204 to an RGBA color before color component clamping to the range [0, 1]:
205
206 1. Color component replacement by the color table specified for
207 GL_COLOR_TABLE, if enabled. See glColorTable.
208
209 2. One-dimensional convolution filtering, if enabled. See
210 glConvolutionFilter1D.
211
212 If a convolution filter changes the __width of the texture (by pro‐
213 cessing with a GL_CONVOLUTION_BORDER_MODE of GL_REDUCE, for exam‐
214 ple), the width must 2n+2(border), for some integer n, after filter‐
215 ing.
216
217 3. RGBA components may be multiplied by GL_POST_CONVOLUTION_c_SCALE,
218 and added to GL_POST_CONVOLUTION_c_BIAS, if enabled. See
219 glPixelTransfer.
220
221 4. Color component replacement by the color table specified for
222 GL_POST_CONVOLUTION_COLOR_TABLE, if enabled. See glColorTable.
223
224 5. Transformation by the color matrix. See glMatrixMode.
225
226 6. RGBA components may be multiplied by GL_POST_COLOR_MATRIX_c_SCALE,
227 and added to GL_POST_COLOR_MATRIX_c_BIAS, if enabled. See
228 glPixelTransfer.
229
230 7. Color component replacement by the color table specified for
231 GL_POST_COLOR_MATRIX_COLOR_TABLE, if enabled. See glColorTable.
232
233 The texture image can be represented by the same data formats as the
234 pixels in a glDrawPixels command, except that GL_STENCIL_INDEX and
235 GL_DEPTH_COMPONENT cannot be used. glPixelStore and glPixelTransfer
236 modes affect texture images in exactly the way they affect
237 glDrawPixels.
238
239 GL_PROXY_TEXTURE_1D may be used only if the GL version is 1.1 or
240 greater.
241
242 Internal formats other than 1, 2, 3, or 4 may be used only if the GL
243 version is 1.1 or greater.
244
245 In GL version 1.1 or greater, pixels may be a null pointer. In this
246 case texture memory is allocated to accommodate a texture of width
247 width. You can then download subtextures to initialize the texture
248 memory. The image is undefined if the program tries to apply an unini‐
249 tialized portion of the texture image to a primitive.
250
251 Formats GL_BGR, and GL_BGRA and types GL_UNSIGNED_BYTE_3_3_2,
252 GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5,
253 GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4,
254 GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1,
255 GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
256 GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, and
257 GL_UNSIGNED_INT_2_10_10_10_REV are available only if the GL version is
258 1.2 or greater.
259
260 When the GL_ARB_multitexture extension is supported, glTexImage1D spec‐
261 ifies the one-dimensional texture for the current texture unit, speci‐
262 fied with glActiveTextureARB.
263
265 GL_INVALID_ENUM is generated if target is not GL_TEXTURE_1D or
266 GL_PROXY_TEXTURE_1D.
267
268 GL_INVALID_ENUM is generated if format is not an accepted
269 constant. Format constants other than GL_STENCIL_INDEX and
270 GL_DEPTH_COMPONENT are accepted.
271
272 GL_INVALID_ENUM is generated if type is not a type constant.
273
274 GL_INVALID_ENUM is generated if type is GL_BITMAP and format is not
275 GL_COLOR_INDEX.
276
277 GL_INVALID_VALUE is generated if level is less than 0.
278
279 GL_INVALID_VALUE may be generated if level is greater than log2max,
280 where max is the returned value of GL_MAX_TEXTURE_SIZE.
281
282 GL_INVALID_VALUE is generated if internalFormat is not 1, 2, 3, 4, or
283 one of the accepted resolution and symbolic constants.
284
285 GL_INVALID_VALUE is generated if width is less than 0 or greater than 2
286 + GL_MAX_TEXTURE_SIZE, or if it cannot be represented as 2n+2(border)
287 for some integer value of n.
288
289 GL_INVALID_VALUE is generated if border is not 0 or 1.
290
291 GL_INVALID_OPERATION is generated if glTexImage1D is executed between
292 the execution of glBegin and the corresponding execution of glEnd.
293
294 GL_INVALID_OPERATION is generated if type is one of
295 GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
296 GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format is
297 not GL_RGB.
298
299 GL_INVALID_OPERATION is generated if type is one of
300 GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
301 GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
302 GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
303 GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV and for‐
304 mat is neither GL_RGBA nor GL_BGRA.
305
307 glGetTexImage
308 glIsEnabled with argument GL_TEXTURE_1D
309
311 glActiveTextureARB(3G), glColorTable(3G), glConvolutionFilter1D(3G),
312 glCopyPixels(3G), glCopyTexImage1D(3G), glCopyTexImage2D(3G),
313 glCopyTexSubImage1D(3G), glCopyTexSubImage2D(3G),
314 glCopyTexSubImage3D(3G), glDrawPixels(3G), glMatrixMode(3G),
315 glPixelStore(3G), glPixelTransfer(3G), glTexEnv(3G), glTexGen(3G),
316 glTexImage2D(3G), glTexImage3D(3G), glTexSubImage1D(3G),
317 glTexSubImage2D(3G), glTexSubImage3D(3G), glTexParameter(3G)
318
319
320
321
322 GLTEXIMAGE1D(3G)