1GLTEXSUBIMAGE2D(3G) GLTEXSUBIMAGE2D(3G)
2
3
4
6 glTexSubImage2D - specify a two-dimensional texture subimage
7
8
10 void glTexSubImage2D( GLenum target,
11 GLint level,
12 GLint xoffset,
13 GLint yoffset,
14 GLsizei width,
15 GLsizei height,
16 GLenum format,
17 GLenum type,
18 const GLvoid *pixels )
19
20
22 target Specifies the target texture. Must be GL_TEXTURE_2D.
23
24 level Specifies the level-of-detail number. Level 0 is the base
25 image level. Level n is the nth mipmap reduction image.
26
27 xoffset Specifies a texel offset in the x direction within the texture
28 array.
29
30 yoffset Specifies a texel offset in the y direction within the texture
31 array.
32
33 width Specifies the width of the texture subimage.
34
35 height Specifies the height of the texture subimage.
36
37 format Specifies the of the pixel data. The following symbolic val‐
38 ues are accepted: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE,
39 GL_ALPHA, GL_RGB, GL_BGR, GL_RGBA, GL_BGRA, GL_LUMINANCE, and
40 GL_LUMINANCE_ALPHA.
41
42 type Specifies the data type of the pixel data. The following sym‐
43 bolic values are accepted: GL_UNSIGNED_BYTE, GL_BYTE,
44 GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT,
45 GL_INT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2,
46 GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5,
47 GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4,
48 GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1,
49 GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
50 GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, and
51 GL_UNSIGNED_INT_2_10_10_10_REV.
52
53 pixels Specifies a pointer to the image data in memory.
54
56 Texturing maps a portion of a specified texture image onto each graphi‐
57 cal primitive for which texturing is enabled. To enable and disable
58 two-dimensional texturing, call glEnable and glDisable with argument
59 GL_TEXTURE_2D.
60
61 glTexSubImage2D redefines a contiguous subregion of an existing two-
62 dimensional texture image. The texels referenced by pixels replace the
63 portion of the existing texture array with x indices xoffset and xoff‐
64 set+width−1, inclusive, and y indices yoffset and yoffset+height−1,
65 inclusive. This region may not include any texels outside the range of
66 the texture array as it was originally specified. It is not an error
67 to specify a subtexture with zero width or height, but such a specifi‐
68 cation has no effect.
69
71 glTexSubImage2D is available only if the GL version is 1.1 or greater.
72
73 Texturing has no effect in color index mode.
74
75 glPixelStore and glPixelTransfer modes affect texture images in exactly
76 the way they affect glDrawPixels.
77
78 Formats GL_BGR, and GL_BGRA and types GL_UNSIGNED_BYTE_3_3_2,
79 GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5,
80 GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4,
81 GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1,
82 GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
83 GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, and
84 GL_UNSIGNED_INT_2_10_10_10_REV are available only if the GL version is
85 1.2 or greater.
86
87 When the GL_ARB_multitexture extension is supported, glTexSubImage2D
88 specifies a two-dimensional sub texture for the current texture unit,
89 specified with glActiveTextureARB.
90
91 When the GL_ARB_imaging extension is supported, the RGBA components
92 specified in pixels may be processed by the imaging pipeline. See
93 glTexImage1D for specific details.
94
96 GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D.
97
98 GL_INVALID_OPERATION is generated if the texture array has not been
99 defined by a previous glTexImage2D operation.
100
101 GL_INVALID_VALUE is generated if level is less than 0.
102
103 GL_INVALID_VALUE may be generated if level is greater than log2max,
104 where max is the returned value of GL_MAX_TEXTURE_SIZE.
105
106 GL_INVALID_VALUE is generated if xoffset<−b, (xoffset+width)>(w−b),
107 yoffset<−b, or (yoffset+height)>(h−b), where w is the GL_TEXTURE_WIDTH,
108 h is the GL_TEXTURE_HEIGHT, and b is the border width of the texture
109 image being modified. Note that w and h include twice the border
110 width.
111
112 GL_INVALID_VALUE is generated if width or height is less than 0.
113
114 GL_INVALID_ENUM is generated if format is not an accepted
115 constant.
116
117 GL_INVALID_ENUM is generated if type is not a type constant.
118
119 GL_INVALID_ENUM is generated if type is GL_BITMAP and format is not
120 GL_COLOR_INDEX.
121
122 GL_INVALID_OPERATION is generated if glTexSubImage2D is executed
123 between the execution of glBegin and the corresponding execution of
124 glEnd.
125
126 GL_INVALID_OPERATION is generated if type is one of
127 GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
128 GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format is
129 not GL_RGB.
130
131 GL_INVALID_OPERATION is generated if type is one of
132 GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
133 GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
134 GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
135 GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV and for‐
136 mat is neither GL_RGBA nor GL_BGRA.
137
139 glGetTexImage
140 glIsEnabled with argument GL_TEXTURE_2D
141
143 glActiveTextureARB(3G), glCopyTexImage1D(3G), glCopyTexImage2D(3G),
144 glCopyTexSubImage1D(3G), glCopyTexSubImage2D(3G),
145 glCopyTexSubImage3D(3G), glDrawPixels(3G), glPixelStore(3G),
146 glPixelTransfer(3G), glTexEnv(3G), glTexGen(3G), glTexImage1D(3G),
147 glTexImage2D(3G), glTexImage3D(3G), glTexSubImage1D(3G),
148 glTexSubImage3D(3G), glTexParameter(3G)
149
150
151
152
153 GLTEXSUBIMAGE2D(3G)