|
|
Line 1: |
Line 1: |
| '''_glTexSubImage2D:''' specify a two-dimensional texture subimage | | {{DISPLAYTITLE:_glTexSubImage2D}} |
| | The '''_glTexSubImage2D''' statement specifies a portion of an existing one-dimensional texture image. |
|
| |
|
|
| |
|
| {{PageSyntax}} | | {{PageSyntax}} |
| | : '''_glTexSubImage2D''' GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|yoffset}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}}, GLenum {{Parameter|format}}, GLenum {{Parameter|type}}, const GLvoid {{Parameter|*pixels}} |
|
| |
|
| SUB _glTexSubImage2D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL xoffset AS LONG, BYVAL yoffset AS LONG, BYVAL width AS LONG, BYVAL height AS LONG, BYVAL format AS _UNSIGNED LONG, BYVAL type AS _UNSIGNED LONG, pixels AS _OFFSET)
| |
| void '''_glTexSubImage2D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|yoffset}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}}, GLenum {{Parameter|format}}, GLenum {{Parameter|type}}, const GLvoid * {{Parameter|data}});
| |
|
| |
|
| | | {{PageParameters}} |
| ; target
| | * OpenGL is using its own set of variable types to describe its command parameters. |
| : Specifies the target texture. Must be {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}.
| | * Use the following table to find the respective QB64 [[Variable Types]]. |
| ; level
| | {{OpenGLTypesPlugin}} |
| : Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
| |
| ; xoffset
| |
| : Specifies a texel offset in the x direction within the texture array.
| |
| ; yoffset
| |
| : Specifies a texel offset in the y direction within the texture array.
| |
| ; width
| |
| : Specifies the width of the texture subimage.
| |
| ; height
| |
| : Specifies the height of the texture subimage.
| |
| {{Glapi pixeltransferupparams|}} | |
|
| |
|
|
| |
|
| {{PageDescription}} | | {{PageDescription}} |
| | | * OpenGL's documentation is available in several places, so we won't reproduce it here for another time. |
| Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled.
| | * The full description for this command can be found at [https://docs.microsoft.com/en-us/windows/win32/opengl/gltexsubimage2d Microsoft Docs] and is also valid for QB64 usage. |
| | |
| '''_glTexSubImage2D''' redefines a contiguous subregion of an existing two-dimensional or one-dimensional array texture image. The texels referenced by {{Parameter|data}} replace the portion of the existing texture array with x indices {{Parameter|xoffset}} and ''xoffset'' + ''width'' - 1, inclusive, and y indices {{Parameter|yoffset}} and ''yoffset'' + ''height'' - 1, inclusive. This region may not include any texels outside the range of the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.
| |
| | |
| If a non-zero named buffer object is bound to the {{KW|_GL_PIXEL_UNPACK_BUFFER}} target (see {{KW|_glBindBuffer}}) while a texture image is specified, {{Parameter|data}} is treated as a byte offset into the buffer object's data store.
| |
| | |
| | |
| {{PageNotes}}
| |
| | |
| {{KW|_glPixelStore}} modes affect texture images.
| |
| | |
| '''_glTexSubImage2D''' specifies a two-dimensional subtexture for the current texture unit, specified with {{KW|_glActiveTexture}}.
| |
| | |
| | |
| {{PageErrors}}
| |
| | |
| {{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}} is not {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}.
| |
| | |
| {{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|format}} is not an accepted format constant.
| |
| | |
| {{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|type}} is not a type constant.
| |
| | |
| {{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
| |
| | |
| {{KW|_GL_INVALID_VALUE}} may be generated if {{Parameter|level}} is greater than log<sub>2</sub>(''max''), where ''max'' is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
| |
| | |
| {{KW|_GL_INVALID_VALUE}} is generated if ''xoffset'' < 0, (''xoffset'' + ''width'') > ''w'', ''yoffset'' < 0, or (''yoffset'' + ''height'') > ''h'', where ''w'' is the {{KW|_GL_TEXTURE_WIDTH}} and ''h'' is the {{KW|_GL_TEXTURE_HEIGHT}}.
| |
| | |
| {{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|width}} or {{Parameter|height}} is less than 0.
| |
| | |
| {{KW|_GL_INVALID_OPERATION}} is generated if the texture array has not been defined by a previous {{KW|_glTexImage2D}} operation.
| |
| | |
| {{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|type}} is one of {{KW|_GL_UNSIGNED_BYTE_3_3_2}}, {{KW|_GL_UNSIGNED_BYTE_2_3_3_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5}}, or {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}} and {{Parameter|format}} is not {{KW|_GL_RGB}}.
| |
| | |
| {{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|type}} is one of {{KW|_GL_UNSIGNED_SHORT_4_4_4_4}}, {{KW|_GL_UNSIGNED_SHORT_4_4_4_4_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_5_5_1}}, {{KW|_GL_UNSIGNED_SHORT_1_5_5_5_REV}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8_REV}}, {{KW|_GL_UNSIGNED_INT_10_10_10_2}}, or {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}} and {{Parameter|format}} is neither {{KW|_GL_RGBA}} nor {{KW|_GL_BGRA}}.
| |
| | |
| {{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_UNPACK_BUFFER}} target and the buffer object's data store is currently mapped.
| |
| | |
| {{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_UNPACK_BUFFER}} target and the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.
| |
| | |
| {{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_UNPACK_BUFFER}} target and {{Parameter|data}} is not evenly divisible into the number of bytes needed to store in memory a datum indicated by {{Parameter|type}}.
| |
| | |
| | |
| {{PageUseWith}}
| |
| | |
| {{KW|_glGetTexImage}}
| |
| | |
| {{KW|_glGet}} with argument {{KW|_GL_PIXEL_UNPACK_BUFFER_BINDING}}
| |
|
| |
|
|
| |
|
| {{PageSeeAlso}} | | {{PageSeeAlso}} |
| | * [[_GL|SUB _GL]] |
|
| |
|
| [[_GL|SUB _GL]]
| |
| {{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glTexSubImage1D}}, {{KW|_glTexSubImage3D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glTexImage2D}}, {{KW|_glTexStorage2D}}, {{KW|_glTextureView}}, {{KW|_glPixelStore}}
| |
|
| |
|
| | {{PageNavigation}} |
|
| |
|
| {{PageCopyright}}
| | [[Category:Final]] |
| | |
| | |
| {{PageNavigation}}
| |
The _glTexSubImage2D statement specifies a portion of an existing one-dimensional texture image.
Syntax
- _glTexSubImage2D GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels
Parameters
- OpenGL is using its own set of variable types to describe its command parameters.
- Use the following table to find the respective QB64 Variable Types.
Table 2: Relations between the OpenGL variable types vs. C/C++ and QB64.
┌──────────────┬────────────────┬──────────────────────────────────────────┐
│ OpenGL │ C/C++ │ QB64 │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLenum │ unsigned int │ _UNSIGNED LONG │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLboolean │ unsigned char │ _UNSIGNED _BYTE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLbitfield │ unsigned int │ _UNSIGNED LONG │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLbyte │ signed char │ _BYTE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLshort │ short │ INTEGER │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLint │ int │ LONG │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLsizei │ int │ LONG │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLubyte │ unsigned char │ _UNSIGNED _BYTE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLushort │ unsigned short │ _UNSIGNED INTEGER │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLuint │ unsigned int │ _UNSIGNED LONG │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLfloat │ float │ SINGLE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLclampf │ float │ SINGLE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLdouble │ double │ DOUBLE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLclampd │ double │ DOUBLE │
├──────────────┼────────────────┼──────────────────────────────────────────┤
│ GLvoid (1) │ void │ _OFFSET(any fixed lenght string or _BYTE │
│ │ │ array element) │
└──────────────┴────────────────┴──────────────────────────────────────────┘
Note: If a parameter has an asterisk (*) in front, then it's a pointer to
the designated OpenGL variable type, rather than a value of that type.
Those must be passed using the _OFFSET(...) notation.
E.g. GLuint *anyParam is actually the offset of a _UNSIGNED LONG (~&)
variable or array, which must be passed as _OFFSET(anyVar~&) or
_OFFSET(anyArr~&()) respectively.
(1) This type is regularly only used for pointers (with asterisk (*)) to
any byte sized memory data, hence _BYTE or fixed length strings.
|
Description
- OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
- The full description for this command can be found at Microsoft Docs and is also valid for QB64 usage.
See also
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link