1GLTEXSUBIMAGE2D(3G) OpenGL Manual GLTEXSUBIMAGE2D(3G)
2
3
4
6 glTexSubImage2D - specify a two-dimensional texture subimage
7
9 void glTexSubImage2D(GLenum target, GLint level, GLint xoffset,
10 GLint yoffset, GLsizei width, GLsizei height,
11 GLenum format, GLenum type, const GLvoid * data);
12
14 target
15 Specifies the target texture. Must be GL_TEXTURE_2D,
16 GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
17 GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
18 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or
19 GL_TEXTURE_1D_ARRAY.
20
21 level
22 Specifies the level-of-detail number. Level 0 is the base image
23 level. Level n is the nth mipmap reduction image.
24
25 xoffset
26 Specifies a texel offset in the x direction within the texture
27 array.
28
29 yoffset
30 Specifies a texel offset in the y direction within the texture
31 array.
32
33 width
34 Specifies the width of the texture subimage.
35
36 height
37 Specifies the height of the texture subimage.
38
39 format
40 Specifies the format of the pixel data. The following symbolic
41 values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, and
42 GL_BGRA.
43
44 type
45 Specifies the data type of the pixel data. The following symbolic
46 values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT,
47 GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT,
48 GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
49 GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
50 GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
51 GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
52 GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
53 GL_UNSIGNED_INT_10_10_10_2, and GL_UNSIGNED_INT_2_10_10_10_REV.
54
55 data
56 Specifies a pointer to the image data in memory.
57
59 Texturing maps a portion of a specified texture image onto each
60 graphical primitive for which texturing is enabled.
61
62 glTexSubImage2D redefines a contiguous subregion of an existing
63 two-dimensional or one-dimensional arary texture image. The texels
64 referenced by data replace the portion of the existing texture array
65 with x indices xoffset and xoffset + width - 1, inclusive, and y
66 indices yoffset and yoffset + height - 1, inclusive. This region may
67 not include any texels outside the range of the texture array as it was
68 originally specified. It is not an error to specify a subtexture with
69 zero width or height, but such a specification has no effect.
70
71 If a non-zero named buffer object is bound to the
72 GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer()) while a texture
73 image is specified, data is treated as a byte offset into the buffer
74 object's data store.
75
77 glPixelStore() modes affect texture images.
78
79 glTexSubImage2D specifies a two-dimensional subtexture for the current
80 texture unit, specified with glActiveTexture().
81
83 GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D,
84 GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
85 GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
86 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or
87 GL_TEXTURE_1D_ARRAY.
88
89 GL_INVALID_ENUM is generated if format is not an accepted format
90 constant.
91
92 GL_INVALID_ENUM is generated if type is not a type constant.
93
94 GL_INVALID_VALUE is generated if level is less than 0.
95
96 GL_INVALID_VALUE may be generated if level is greater than log 2max,
97 where max is the returned value of GL_MAX_TEXTURE_SIZE.
98
99 GL_INVALID_VALUE is generated if xoffset < - b, xoffset + width > w -
100 b, yoffset < - b, or yoffset + height > h - b, where w is the
101 GL_TEXTURE_WIDTH, h is the GL_TEXTURE_HEIGHT, and b is the border width
102 of the texture image being modified. Note that w and h include twice
103 the border width.
104
105 GL_INVALID_VALUE is generated if width or height is less than 0.
106
107 GL_INVALID_OPERATION is generated if the texture array has not been
108 defined by a previous glTexImage2D() operation.
109
110 GL_INVALID_OPERATION is generated if type is one of
111 GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
112 GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format is
113 not GL_RGB.
114
115 GL_INVALID_OPERATION is generated if type is one of
116 GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
117 GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
118 GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
119 GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV and
120 format is neither GL_RGBA nor GL_BGRA.
121
122 GL_INVALID_OPERATION is generated if a non-zero buffer object name is
123 bound to the GL_PIXEL_UNPACK_BUFFER target and the buffer object's data
124 store is currently mapped.
125
126 GL_INVALID_OPERATION is generated if a non-zero buffer object name is
127 bound to the GL_PIXEL_UNPACK_BUFFER target and the data would be
128 unpacked from the buffer object such that the memory reads required
129 would exceed the data store size.
130
131 GL_INVALID_OPERATION is generated if a non-zero buffer object name is
132 bound to the GL_PIXEL_UNPACK_BUFFER target and data is not evenly
133 divisible into the number of bytes needed to store in memory a datum
134 indicated by type.
135
137 glGetTexImage()
138
139 glGet() with argument GL_PIXEL_UNPACK_BUFFER_BINDING
140
142 glActiveTexture(), glCopyTexImage1D(), glCopyTexImage2D(),
143 glCopyTexSubImage1D(), glCopyTexSubImage2D(), glCopyTexSubImage3D(),
144 glPixelStore(), glTexImage1D(), glTexImage2D(), glTexImage3D(),
145 glTexSubImage1D(), glTexSubImage3D(), glTexParameter()
146
148 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
149 under the SGI Free Software B License. For details, see
150 http://oss.sgi.com/projects/FreeB/.
151
153 opengl.org
154
155
156
157opengl.org 06/10/2014 GLTEXSUBIMAGE2D(3G)