1GLTEXIMAGE1D(3G)                 OpenGL Manual                GLTEXIMAGE1D(3G)
2
3
4

NAME

6       glTexImage1D - specify a one-dimensional texture image
7

C SPECIFICATION

9       void glTexImage1D(GLenum target, GLint level, GLint internalFormat,
10                         GLsizei width, GLint border, GLenum format,
11                         GLenum type, const GLvoid * data);
12

PARAMETERS

14       target
15           Specifies the target texture. Must be GL_TEXTURE_1D or
16           GL_PROXY_TEXTURE_1D.
17
18       level
19           Specifies the level-of-detail number. Level 0 is the base image
20           level. Level n is the nth mipmap reduction image.
21
22       internalFormat
23           Specifies the number of color components in the texture. Must be
24           one of base internal formats given in Table 1, one of the sized
25           internal formats given in Table 2, or one of the compressed
26           internal formats given in Table 3, below.
27
28       width
29           Specifies the width of the texture image. All implementations
30           support texture images that are at least 1024 texels wide. The
31           height of the 1D texture image is 1.
32
33       border
34           This value must be 0.
35
36       format
37           Specifies the format of the pixel data. The following symbolic
38           values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, and
39           GL_BGRA.
40
41       type
42           Specifies the data type of the pixel data. The following symbolic
43           values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT,
44           GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT,
45           GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
46           GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
47           GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
48           GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
49           GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
50           GL_UNSIGNED_INT_10_10_10_2, and GL_UNSIGNED_INT_2_10_10_10_REV.
51
52       data
53           Specifies a pointer to the image data in memory.
54

DESCRIPTION

56       Texturing maps a portion of a specified texture image onto each
57       graphical primitive for which texturing is enabled. To enable and
58       disable one-dimensional texturing, call glEnable() and glDisable() with
59       argument GL_TEXTURE_1D.
60
61       Texture images are defined with glTexImage1D. The arguments describe
62       the parameters of the texture image, such as width, width of the
63       border, level-of-detail number (see glTexParameter()), and the internal
64       resolution and format used to store the image. The last three arguments
65       describe how the image is represented in memory.
66
67       If target is GL_PROXY_TEXTURE_1D, no data is read from data, but all of
68       the texture image state is recalculated, checked for consistency, and
69       checked against the implementation's capabilities. If the
70       implementation cannot handle a texture of the requested texture size,
71       it sets all of the image state to 0, but does not generate an error
72       (see glGetError()). To query for an entire mipmap array, use an image
73       array level greater than or equal to 1.
74
75       If target is GL_TEXTURE_1D, data is read from data as a sequence of
76       signed or unsigned bytes, shorts, or longs, or single-precision
77       floating-point values, depending on type. These values are grouped into
78       sets of one, two, three, or four values, depending on format, to form
79       elements. Each data byte is treated as eight 1-bit elements, with bit
80       ordering determined by GL_UNPACK_LSB_FIRST (see glPixelStore()).
81
82       If a non-zero named buffer object is bound to the
83       GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer()) while a texture
84       image is specified, data is treated as a byte offset into the buffer
85       object's data store.
86
87       The first element corresponds to the left end of the texture array.
88       Subsequent elements progress left-to-right through the remaining texels
89       in the texture array. The final element corresponds to the right end of
90       the texture array.
91
92       format determines the composition of each element in data. It can
93       assume one of these symbolic values:
94
95       GL_RED
96           Each element is a single red component. The GL converts it to
97           floating point and assembles it into an RGBA element by attaching 0
98           for green and blue, and 1 for alpha. Each component is then
99           multiplied by the signed scale factor GL_c_SCALE, added to the
100           signed bias GL_c_BIAS, and clamped to the range [0,1].
101
102       GL_RG
103           Each element is a single red/green double The GL converts it to
104           floating point and assembles it into an RGBA element by attaching 0
105           for blue, and 1 for alpha. Each component is then multiplied by the
106           signed scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS,
107           and clamped to the range [0,1].
108
109       GL_RGB
110
111       GL_BGR
112           Each element is an RGB triple. The GL converts it to floating point
113           and assembles it into an RGBA element by attaching 1 for alpha.
114           Each component is then multiplied by the signed scale factor
115           GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped to the
116           range [0,1].
117
118       GL_RGBA
119
120       GL_BGRA
121           Each element contains all four components. Each component is
122           multiplied by the signed scale factor GL_c_SCALE, added to the
123           signed bias GL_c_BIAS, and clamped to the range [0,1].
124
125       GL_DEPTH_COMPONENT
126           Each element is a single depth value. The GL converts it to
127           floating point, multiplies by the signed scale factor
128           GL_DEPTH_SCALE, adds the signed bias GL_DEPTH_BIAS, and clamps to
129           the range [0,1].
130
131       If an application wants to store the texture at a certain resolution or
132       in a certain format, it can request the resolution and format with
133       internalFormat. The GL will choose an internal representation that
134       closely approximates that requested by internalFormat, but it may not
135       match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB
136       and GL_RGBA must match exactly.)
137
138       internalFormat may be one of the base internal formats shown in Table
139       1, below
140
141       <xi:include></xi:include>
142
143       internalFormat may also be one of the sized internal formats shown in
144       Table 2, below
145
146       <xi:include></xi:include>
147
148       Finally, internalFormat may also be one of the generic or compressed
149       compressed texture formats shown in Table 3 below
150
151       <xi:include></xi:include>
152
153       If the internalFormat parameter is one of the generic compressed
154       formats, GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or
155       GL_COMPRESSED_RGBA, the GL will replace the internal format with the
156       symbolic constant for a specific internal format and compress the
157       texture before storage. If no corresponding internal format is
158       available, or the GL can not compress that image for any reason, the
159       internal format is instead replaced with a corresponding base internal
160       format.
161
162       If the internalFormat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHAor
163       GL_SRGB8_ALPHA8, the texture is treated as if the red, green, or blue
164       components are encoded in the sRGB color space. Any alpha component is
165       left unchanged. The conversion from the sRGB encoded component c s to a
166       linear component c l is:
167
168       c l = { c s 12.92 if c s ≤ 0.04045 ( c s + 0.055 1.055 ) 2.4 if c s >
169       0.04045
170
171       Assume c s is the sRGB component in the range [0,1].
172
173       Use the GL_PROXY_TEXTURE_1D target to try out a resolution and format.
174       The implementation will update and recompute its best match for the
175       requested storage resolution and format. To then query this state, call
176       glGetTexLevelParameter(). If the texture cannot be accommodated,
177       texture state is set to 0.
178
179       A one-component texture image uses only the red component of the RGBA
180       color from data. A two-component image uses the R and A values. A
181       three-component image uses the R, G, and B values. A four-component
182       image uses all of the RGBA components.
183
184       Image-based shadowing can be enabled by comparing texture r coordinates
185       to depth texture values to generate a boolean result. See
186       glTexParameter() for details on texture comparison.
187

NOTES

189       glPixelStore() modes affect texture images.
190
191       data may be a null pointer. In this case texture memory is allocated to
192       accommodate a texture of width width. You can then download subtextures
193       to initialize the texture memory. The image is undefined if the program
194       tries to apply an uninitialized portion of the texture image to a
195       primitive.
196
197       glTexImage1D specifies the one-dimensional texture for the current
198       texture unit, specified with glActiveTexture().
199

ERRORS

201       GL_INVALID_ENUM is generated if target is not GL_TEXTURE_1D or
202       GL_PROXY_TEXTURE_1D.
203
204       GL_INVALID_ENUM is generated if format is not an accepted format
205       constant. Format constants other than GL_STENCIL_INDEX are accepted.
206
207       GL_INVALID_ENUM is generated if type is not a type constant.
208
209       GL_INVALID_VALUE is generated if level is less than 0.
210
211       GL_INVALID_VALUE may be generated if level is greater than log 2 ⁡ max,
212       where max is the returned value of GL_MAX_TEXTURE_SIZE.
213
214       GL_INVALID_VALUE is generated if internalFormat is not one of the
215       accepted resolution and format symbolic constants.
216
217       GL_INVALID_VALUE is generated if width is less than 0 or greater than
218       GL_MAX_TEXTURE_SIZE.
219
220       GL_INVALID_VALUE is generated if non-power-of-two textures are not
221       supported and the width cannot be represented as 2 n + 2 ⁡ border for
222       some integer value of n.
223
224       GL_INVALID_VALUE is generated if border is not 0 or 1.
225
226       GL_INVALID_OPERATION is generated if type is one of
227       GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
228       GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format is
229       not GL_RGB.
230
231       GL_INVALID_OPERATION is generated if type is one of
232       GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
233       GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
234       GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
235       GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV and
236       format is neither GL_RGBA nor GL_BGRA.
237
238       GL_INVALID_OPERATION is generated if format is GL_DEPTH_COMPONENT and
239       internalFormat is not GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16,
240       GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32.
241
242       GL_INVALID_OPERATION is generated if internalFormat is
243       GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or
244       GL_DEPTH_COMPONENT32, and format is not GL_DEPTH_COMPONENT.
245
246       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
247       bound to the GL_PIXEL_UNPACK_BUFFER target and the buffer object's data
248       store is currently mapped.
249
250       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
251       bound to the GL_PIXEL_UNPACK_BUFFER target and the data would be
252       unpacked from the buffer object such that the memory reads required
253       would exceed the data store size.
254
255       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
256       bound to the GL_PIXEL_UNPACK_BUFFER target and data is not evenly
257       divisible into the number of bytes needed to store in memory a datum
258       indicated by type.
259

ASSOCIATED GETS

261       glGetTexImage()
262
263       glGet() with argument GL_PIXEL_UNPACK_BUFFER_BINDING
264

SEE ALSO

266       glActiveTexture(), glCompressedTexImage1D(),
267       glCompressedTexSubImage1D(), glCopyTexImage1D(), glCopyTexSubImage1D(),
268       glGetCompressedTexImage(), glPixelStore(), glTexImage2D(),
269       glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(),
270       glTexSubImage3D(), glTexParameter()
271
273       Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2011 Khronos
274       Group. This document is licensed under the SGI Free Software B License.
275       For details, see http://oss.sgi.com/projects/FreeB/.
276

AUTHORS

278       opengl.org
279
280
281
282opengl.org                        06/10/2014                  GLTEXIMAGE1D(3G)
Impressum