mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-31 00:40:17 +00:00
82 lines
7.7 KiB
Text
82 lines
7.7 KiB
Text
|
'''_glGetTexImage:''' return a texture image
|
||
|
|
||
|
|
||
|
{{PageSyntax}}
|
||
|
|
||
|
SUB _glGetTexImage (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL format AS _UNSIGNED LONG, BYVAL type AS _UNSIGNED LONG, pixels AS _OFFSET)
|
||
|
void '''_glGetTexImage'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLenum {{Parameter|format}}, GLenum {{Parameter|type}}, GLvoid * {{Parameter|img}});
|
||
|
|
||
|
|
||
|
; target
|
||
|
: Specifies which texture is to be obtained. {{KW|_GL_TEXTURE_1D}}, {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_3D}}, {{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_2D_ARRAY}}, {{KW|_GL_TEXTURE_RECTANGLE}}, {{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}}, and {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}} are accepted.
|
||
|
; level
|
||
|
: Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
|
||
|
; format
|
||
|
: Specifies a pixel format for the returned data. The supported formats are {{KW|_GL_STENCIL_INDEX}}, {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_DEPTH_STENCIL}}, {{KW|_GL_RED}}, {{KW|_GL_GREEN}}, {{KW|_GL_BLUE}}, {{KW|_GL_RG}}, {{KW|_GL_RGB}}, {{KW|_GL_RGBA}}, {{KW|_GL_BGR}}, {{KW|_GL_BGRA}}, {{KW|_GL_RED_INTEGER}}, {{KW|_GL_GREEN_INTEGER}}, {{KW|_GL_BLUE_INTEGER}}, {{KW|_GL_RG_INTEGER}}, {{KW|_GL_RGB_INTEGER}}, {{KW|_GL_RGBA_INTEGER}}, {{KW|_GL_BGR_INTEGER}}, {{KW|_GL_BGRA_INTEGER}}.
|
||
|
; type
|
||
|
: Specifies a pixel type for the returned data. The supported types are {{KW|_GL_UNSIGNED_BYTE}}, {{KW|_GL_BYTE}}, {{KW|_GL_UNSIGNED_SHORT}}, {{KW|_GL_SHORT}}, {{KW|_GL_UNSIGNED_INT}}, {{KW|_GL_INT}}, {{KW|_GL_HALF_FLOAT}}, {{KW|_GL_FLOAT}}, {{KW|_GL_UNSIGNED_BYTE_3_3_2}}, {{KW|_GL_UNSIGNED_BYTE_2_3_3_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}}, {{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}}, {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}}, {{KW|_GL_UNSIGNED_INT_24_8}}, {{KW|_GL_UNSIGNED_INT_10F_11F_11F_REV}}, {{KW|_GL_UNSIGNED_INT_5_9_9_9_REV}}, and {{KW|_GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
|
||
|
; img
|
||
|
: Returns the texture image. Should be a pointer to an array of the type specified by {{Parameter|type}}.
|
||
|
|
||
|
|
||
|
{{PageDescription}}
|
||
|
|
||
|
'''_glGetTexImage''' returns a texture image into {{Parameter|img}}. {{Parameter|target}} specifies whether the desired texture image is one specified by {{KW|_glTexImage1D}} ({{KW|_GL_TEXTURE_1D}}), {{KW|_glTexImage2D}} ({{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_RECTANGLE}}, {{KW|_GL_TEXTURE_2D}} or any of {{KW|_GL_TEXTURE_CUBE_MAP_*}}), or {{KW|_glTexImage3D}} ({{KW|_GL_TEXTURE_2D_ARRAY}}, {{KW|_GL_TEXTURE_3D}}). {{Parameter|level}} specifies the level-of-detail number of the desired image. {{Parameter|format}} and {{Parameter|type}} specify the format and type of the desired image array. See the reference page for {{KW|_glTexImage1D}} for a description of the acceptable values for the {{Parameter|format}} and {{Parameter|type}} parameters, respectively.
|
||
|
|
||
|
If a non-zero named buffer object is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target (see {{KW|_glBindBuffer}}) while a texture image is requested, {{Parameter|img}} is treated as a byte offset into the buffer object's data store.
|
||
|
|
||
|
To understand the operation of '''_glGetTexImage''', consider the selected internal four-component texture image to be an RGBA color buffer the size of the image. The semantics of '''_glGetTexImage''' are then identical to those of {{KW|_glReadPixels}}, with the exception that no pixel transfer operations are performed, when called with the same {{Parameter|format}} and {{Parameter|type}}, with ''x'' and ''y'' set to 0, ''width'' set to the width of the texture image and ''height'' set to 1 for 1D images, or to the height of the texture image for 2D images.
|
||
|
|
||
|
If the selected texture image does not contain four components, the following mappings are applied. Single-component textures are treated as RGBA buffers with red set to the single-component value, green set to 0, blue set to 0, and alpha set to 1. Two-component textures are treated as RGBA buffers with red set to the value of component zero, alpha set to the value of component one, and green and blue set to 0. Finally, three-component textures are treated as RGBA buffers with red set to component zero, green set to component one, blue set to component two, and alpha set to 1.
|
||
|
|
||
|
To determine the required size of {{Parameter|img}}, use {{KW|_glGetTexLevelParameter}} to determine the dimensions of the internal texture image, then scale the required number of pixels by the storage required for each pixel, based on {{Parameter|format}} and {{Parameter|type}}. Be sure to take the pixel storage parameters into account, especially {{KW|_GL_PACK_ALIGNMENT}}.
|
||
|
|
||
|
|
||
|
{{PageNotes}}
|
||
|
|
||
|
If an error is generated, no change is made to the contents of {{Parameter|img}}.
|
||
|
|
||
|
'''_glGetTexImage''' returns the texture image for the active texture unit.
|
||
|
|
||
|
|
||
|
{{PageErrors}}
|
||
|
|
||
|
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}}, {{Parameter|format}}, or {{Parameter|type}} is not an accepted value.
|
||
|
|
||
|
{{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_OPERATION}} is returned 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}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}}, or {{KW|_GL_UNSIGNED_INT_10F_11F_11F_REV}} and {{Parameter|format}} is not {{KW|_GL_RGB}}.
|
||
|
|
||
|
{{KW|_GL_INVALID_OPERATION}} is returned 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}}, {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}}, or {{KW|_GL_UNSIGNED_INT_5_9_9_9_REV}} and {{Parameter|format}} is neither {{KW|_GL_RGBA}} or {{KW|_GL_BGRA}}.
|
||
|
|
||
|
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_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_PACK_BUFFER}} target and the data would be packed to the buffer object such that the memory writes 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_PACK_BUFFER}} target and {{Parameter|img}} is not evenly divisible into the number of bytes needed to store in memory a datum indicated by {{Parameter|type}}.
|
||
|
|
||
|
|
||
|
{{PageUseWith}}
|
||
|
|
||
|
{{KW|_glGetTexLevelParameter}} with argument {{KW|_GL_TEXTURE_WIDTH}}
|
||
|
|
||
|
{{KW|_glGetTexLevelParameter}} with argument {{KW|_GL_TEXTURE_HEIGHT}}
|
||
|
|
||
|
{{KW|_glGetTexLevelParameter}} with argument {{KW|_GL_TEXTURE_INTERNAL_FORMAT}}
|
||
|
|
||
|
{{KW|_glGet}} with arguments {{KW|_GL_PACK_ALIGNMENT}} and others
|
||
|
|
||
|
{{KW|_glGet}} with argument {{KW|_GL_PIXEL_PACK_BUFFER_BINDING}}
|
||
|
|
||
|
|
||
|
{{PageSeeAlso}}
|
||
|
|
||
|
{{KW|_GL}}
|
||
|
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glPixelStore}}, {{KW|_glReadPixels}}, {{KW|_glTexSubImage1D}}, {{KW|_glTexSubImage2D}}, {{KW|_glTexSubImage3D}}
|
||
|
|
||
|
|
||
|
{{PageCopyright}}
|
||
|
|
||
|
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].
|