GlGetTexImage
_glGetTexImage: return a texture image
Syntax
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 target, GLint level, GLenum format, GLenum type, GLvoid * img);
- target
- Specifies which texture is to be obtained. Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, and Template:KW are accepted.
- level
- Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level n is the nth mipmap reduction image.
- format
- Specifies a pixel format for the returned data. The supported formats are Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW.
- type
- Specifies a pixel type for the returned data. The supported types are Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, and Template:KW.
- img
- Returns the texture image. Should be a pointer to an array of the type specified by type.
Description
_glGetTexImage returns a texture image into img. target specifies whether the desired texture image is one specified by Template:KW (Template:KW), Template:KW (Template:KW, Template:KW, Template:KW or any of Template:KW), or Template:KW (Template:KW, Template:KW). level specifies the level-of-detail number of the desired image. format and type specify the format and type of the desired image array. See the reference page for Template:KW for a description of the acceptable values for the format and type parameters, respectively.
If a non-zero named buffer object is bound to the Template:KW target (see Template:KW) while a texture image is requested, 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 Template:KW, with the exception that no pixel transfer operations are performed, when called with the same format and 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 img, use Template:KW 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 format and type. Be sure to take the pixel storage parameters into account, especially Template:KW.
If an error is generated, no change is made to the contents of img.
_glGetTexImage returns the texture image for the active texture unit.
Template:KW is generated if target, format, or type is not an accepted value.
Template:KW is generated if level is less than 0.
Template:KW may be generated if level is greater than log<sub>2</sub>(max), where max is the returned value of Template:KW.
Template:KW is returned if type is one of Template:KW, Template:KW, Template:KW, Template:KW, or Template:KW and format is not Template:KW.
Template:KW is returned if type is one of Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, or Template:KW and format is neither Template:KW or Template:KW.
Template:KW is generated if a non-zero buffer object name is bound to the Template:KW target and the buffer object's data store is currently mapped.
Template:KW is generated if a non-zero buffer object name is bound to the Template:KW target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size.
Template:KW is generated if a non-zero buffer object name is bound to the Template:KW target and img is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.
Template:KW with argument Template:KW
Template:KW with argument Template:KW
Template:KW with argument Template:KW
Template:KW with arguments Template:KW and others
Template:KW with argument Template:KW
See also
SUB _GL Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW
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/.