Detailed description of the Glteximage2d

Source: Internet
Author: User
Name

Glteximage2d-specify a two-dimensional texture image C specification

void Glteximage2d ( Glenum Target,
Glint level,
Glint Internalformat,
Glsizei width,
Glsizei height,
Glint Border,
Glenum format,
Glenum type,
Const glvoid * data);
ParametersTarget

Specifies the target texture. Must be gl_texture_2d, gl_proxy_texture_2d, Gl_texture_1d_array, Gl_proxy_texture_1d_array,gl_texture_rectangle, GL_ Proxy_texture_rectangle, gl_texture_cube_map_positive_x, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,GL_TEXTURE_CUBE_MAP_ Positive_y, Gl_texture_cube_map_negative_y, Gl_texture_cube_map_positive_z, Gl_texture_cube_map_negative_z, orGL_ Proxy_texture_cube_map. Level

Specifies the level-of-detail number. Level 0 are the base image level. Level n is the nth mipmap reduction image. If Target is Gl_texture_rectangle Orgl_proxy_texture_rectangle, level must be 0. Internalformat

Specifies the number of color in the texture. Must is one of the base internal formats given in table 1, one of the sized internal formats given in table 2, or one of the C ompressed internal formats given in Table 3, below. Width

Specifies the width of the texture image. All implementations support texture images is at least, texels wide. Height

Specifies the height of the texture image, or the number of layers in a texture array, in the case of the Gl_texture_1d_ar RAY Andgl_proxy_texture_1d_array targets. All implementations support 2D texture images that is at least 1024x768 texels high, and texture arrays that is at least 256 Layers deep. Border

This value must is 0. Format

Specifies the format of the pixel data.  The following symbolic values are accepted:gl_red, GL_RG, Gl_rgb, GL_BGR, Gl_rgba, Gl_bgra,gl_red_integer, GL_RG_INTEGER, Gl_rgb_integer, Gl_bgr_integer, Gl_rgba_integer, Gl_bgra_integer, Gl_stencil_index,gl_depth_component, GL_DEPTH_ Stencil. Type

Specifies the data type of the pixel data. The following symbolic values are Accepted:gl_unsigned_byte, Gl_byte, Gl_unsigned_short, Gl_short,gl_unsigned_int, GL_ INT, Gl_float, Gl_unsigned_byte_3_3_2, Gl_unsigned_byte_2_3_3_rev, Gl_unsigned_short_5_6_5,gl_unsigned_short_5_6_5 _rev, Gl_unsigned_short_4_4_4_4, Gl_unsigned_short_4_4_4_4_rev, Gl_unsigned_short_5_5_5_1,gl_unsigned_short_1_5_5 _5_rev, Gl_unsigned_int_8_8_8_8, Gl_unsigned_int_8_8_8_8_rev, Gl_unsigned_int_10_10_10_2, andGL_UNSIGNED_INT_2_10_ 10_10_rev. Data

Specifies a pointer to the image data in memory. Description

Texturing allows elements of an image array to is read by shaders.

To define texture images, call glteximage2d. The arguments describe the parameters of the texture image, such as height, width, width of the border, Level-of-detail Nu Mber (see Gltexparameter), and number of the color components provided. The last three arguments describe how the image was represented in memory.

If Target is gl_proxy_texture_2d, Gl_proxy_texture_1d_array, Gl_proxy_texture_cube_map, or Gl_proxy_texture_rectangle , no data is read Fromdata, but all of the texture image are recalculated, checked for consistency, and checked again St The implementation ' s capabilities. If the implementation cannot handle a texture of the requested texture size, it sets all of the image state to 0, but does Not generate a error (see GLGETERROR). To a entire mipmap array, use a image array level greater than or equal to 1.

If Target is gl_texture_2d, gl_texture_rectangle or one of the gl_texture_cube_map targets, data is read from data as a SE Quence of signed or unsigned bytes, shorts, or longs, or single-precision floating-point values, depending on type. These values is grouped into sets of one, the other, the three, or four values, the depending on format, and the to form elements. Each data byte was treated as eight 1-bit elements, with bit ordering determined by Gl_unpack_lsb_first (Seeglpixelstore).

If Target is Gl_texture_1d_array, the data is interpreted as an ARRAY of one-dimensional images.

If a Non-zero named buffer object is bound to the Gl_pixel_unpack_buffer target (see Glbindbuffer) while a texture image I s specified, data is treated as a byte offset into the buffer object ' s data store.

The first element corresponds to the lower left corner of the texture image. Subsequent elements progress left-to-right through the remaining texels in the lowest row of the texture image, and then I n successively higher rows of the texture image. The final element corresponds to the upper right corner of the texture image.

Format determines the composition of each element in data. It can assume one of these symbolic values:gl_red

Each element was a single red component. The GL converts it to floating point and assembles it into a RGBA element by attaching 0 for green and blue, and 1 for AL Pha. Each component are clamped to the range [0,1]. Gl_rg

Each element is a red/green double. The GL converts it to floating point and assembles it into a RGBA element by attaching 0 for Blue, and 1 for Alpha. Each component are clamped to the range [0,1]. Gl_rgb, GL_BGR

Each element was an RGB triple. The GL converts it to floating point and assembles it into a RGBA element by attaching 1 for Alpha. Each component are clamped to the range [0,1]. Gl_rgba, Gl_bgra

Each element contains. Each component are clamped to the range [0,1]. Gl_depth_component

Each element was a single depth value. The GL converts it to floating point and clamps to the range [0,1]. Gl_depth_stencil

Each element is a pair of depth and stencil values. The depth component of the pair are interpreted as in gl_depth_component. The stencil component is interpreted based on specified the depth + stencil internal format.

If an application wants to store the texture @ a certain resolution or in a certain format, it can request the resolution and format with Internalformat. The GL would choose an internal representation this closely approximates that requested by Internalformat, but it could not m Atch exactly. (The representations specified by gl_red, Gl_rg, Gl_rgb, and Gl_rgba must match exactly.)

Internalformat May is one of the base internal formats shown in Table 1, below

Table 1. Base Internal Formats

Components
Base Internal Format RGBA, Depth and stencil Values Internal
Gl_depth_component Depth D
Gl_depth_stencil Depth, stencil Ds
Gl_red Red R
Gl_rg Red, Green R, G
Gl_rgb Red, Green, Blue R, G, B
Gl_rgba Red, Green, Blue, Alpha R, G, B, A


Internalformat may also is one of the sized internal formats shown in Table 2, below

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.