home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / OpenGL / extensions / spec / texture.spec < prev    next >
Encoding:
Text File  |  1996-11-11  |  17.6 KB  |  437 lines

  1. Name
  2.  
  3.     EXT_texture
  4.  
  5. Name Strings
  6.  
  7.     GL_EXT_texture
  8.  
  9. Version
  10.  
  11.     $Date: 1995/09/30 02:32:31 $ $Revision: 1.1 $
  12.  
  13. Number
  14.  
  15.     4
  16.  
  17. Dependencies
  18.  
  19.     None
  20.  
  21. Overview
  22.  
  23.     The original intention of this extension was simply to support various
  24.     numeric resolutions of color components in texture images.  While it
  25.     accomplishes this, it also accomplishes a larger task, that of
  26.     formalizing the notion of an internal format for images, corresponding
  27.     to the external format that already existed for image data in host
  28.     memory.  This notion of an internal image format will be used
  29.     extensively in later extensions, especially those concerned with pixel
  30.     manipulation.
  31.  
  32.     The idea of an internal format is simple: rather than treating a
  33.     retained image as having 1, 2, 3, or 4 components, treat it as though
  34.     it has a specific format, such as LUMINANCE_ALPHA, or just ALPHA.  Then
  35.     define the semantics of the use of internal images with these formats in
  36.     a consistent way.  Because texture mapping is already defined in GL, the
  37.     semantics for internal-format images were chosen to match those of the 1,
  38.     2, 3, and 4 component internal images that already existed.  The new
  39.     semantics are a superset of the old ones, however, so this extension
  40.     adds capabilities to GL, as well as allowing internal resolutions to be
  41.     specified.
  42.  
  43.     This extension also defines a robust method for applications to
  44.     determine what combinations of texture dimensions and resolutions are
  45.     supported by an implementation.  It also introduces a new texture
  46.     environment: REPLACE_EXT.
  47.  
  48. New Procedures and Functions
  49.  
  50.     None
  51.  
  52. New Tokens
  53.  
  54.     Accepted by the <components> parameter of TexImage1D and TexImage2D:
  55.  
  56.     ALPHA4_EXT                       0x803B
  57.     ALPHA8_EXT                       0x803C
  58.     ALPHA12_EXT                      0x803D
  59.     ALPHA16_EXT                      0x803E
  60.     LUMINANCE4_EXT                   0x803F
  61.     LUMINANCE8_EXT                   0x8040
  62.     LUMINANCE12_EXT                  0x8041
  63.     LUMINANCE16_EXT                  0x8042
  64.     LUMINANCE4_ALPHA4_EXT            0x8043
  65.     LUMINANCE6_ALPHA2_EXT            0x8044
  66.     LUMINANCE8_ALPHA8_EXT            0x8045
  67.     LUMINANCE12_ALPHA4_EXT           0x8046
  68.     LUMINANCE12_ALPHA12_EXT          0x8047
  69.     LUMINANCE16_ALPHA16_EXT          0x8048
  70.     INTENSITY_EXT                    0x8049
  71.     INTENSITY4_EXT                   0x804A
  72.     INTENSITY8_EXT                   0x804B
  73.     INTENSITY12_EXT                  0x804C
  74.     INTENSITY16_EXT                  0x804D
  75.     RGB2_EXT                         0x804E
  76.     RGB4_EXT                         0x804F
  77.     RGB5_EXT                         0x8050
  78.     RGB8_EXT                         0x8051
  79.     RGB10_EXT                        0x8052
  80.     RGB12_EXT                        0x8053
  81.     RGB16_EXT                        0x8054
  82.     RGBA2_EXT                        0x8055
  83.     RGBA4_EXT                        0x8056
  84.     RGB5_A1_EXT                      0x8057
  85.     RGBA8_EXT                        0x8058
  86.     RGB10_A2_EXT                     0x8059
  87.     RGBA12_EXT                       0x805A
  88.     RGBA16_EXT                       0x805B
  89.  
  90.     Accepted by the <pname> parameters of GetTexLevelParameteriv and
  91.     GetTexLevelParameterfv:
  92.  
  93.     TEXTURE_RED_SIZE_EXT             0x805C
  94.     TEXTURE_GREEN_SIZE_EXT           0x805D
  95.     TEXTURE_BLUE_SIZE_EXT            0x805E
  96.     TEXTURE_ALPHA_SIZE_EXT           0x805F
  97.     TEXTURE_LUMINANCE_SIZE_EXT       0x8060
  98.     TEXTURE_INTENSITY_SIZE_EXT       0x8061
  99.  
  100.     Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and
  101.     TexEnvfi when the <pname> parameter value is
  102.     GL_TEXTURE_ENV_MODE
  103.  
  104.     REPLACE_EXT                      0x8062
  105.  
  106.     Accepted by the <target> parameters of TexImage1D,
  107.     GetTexLevelParameteriv, and GetTexLevelParameterfv:
  108.  
  109.     PROXY_TEXTURE_1D_EXT             0x8063
  110.  
  111.     Accepted by the <target> parameters of TexImage2D,
  112.     GetTexLevelParameteriv, and GetTexLevelParameterfv:
  113.  
  114.     PROXY_TEXTURE_2D_EXT             0x8064
  115.  
  116. Additions to Chapter 2 of the GL Specification (OpenGL Operation)
  117.  
  118.     A new error token value, TEXTURE_TOO_LARGE_EXT, is defined and added to
  119.     table 2.3:
  120.  
  121.                                        Offending
  122.                                        command
  123.     Error            Description                   ignored?
  124.     -----            -----------                   ---------
  125.     INVALID_ENUM        enum argument out of range           Yes
  126.     INVALID_VALUE        Numeric argument out of range           Yes
  127.     INVALID_OPERATION    Operation illegal in current state       Yes
  128.     STACK_OVERFLOW        Command would cause a stack overflow       Yes
  129.     STACK_UNDERFLOW        Command would cause a stack underflow       Yes
  130.     TEXTURE_TOO_LARGE_EXT    The specified texture is too large       Yes
  131.     OUT_OF_MEMORY        Not enough memory left to execute command  Unknown
  132.  
  133.     Table 2.3: Summary of GL errors
  134.  
  135.      and defined as follows:
  136.  
  137.     TEXTURE_TOO_LARGE_EXT            0x8065
  138.  
  139. Additions to Chapter 3 of the GL Specification (Rasterization)
  140.  
  141.     Many additional values can be specified for the <components> parameter
  142.     of TexImage1D and TexImage2D.  The GL Specification indicates (in
  143.     section 3.8) that only values 1, 2, 3, and 4 can be specified.  This
  144.     extension defines semantics for the currently existing tokens ALPHA,
  145.     RGB, RGBA, LUMINANCE, and LUMINANCE_ALPHA, and also defines semantics
  146.     for many new tokens.  Each of the new tokens (except INTENSITY_EXT)
  147.     indicates a desired storage resolution, as well as a base format.  These
  148.     tokens are:
  149.  
  150.                                 Red    Green    Blue    Alpha    Luminance   Intensity
  151.     Token name            Base format        Bits    Bits    Bits    Bits    Bits        Bits
  152.     ----------            -----------        ----    ----    ----    ----    ----        ----
  153.  
  154.     ALPHA4_EXT            ALPHA                                   4
  155.     ALPHA8_EXT            ALPHA                                   8
  156.     ALPHA12_EXT            ALPHA                                  12
  157.     ALPHA16_EXT            ALPHA                                  16
  158.     LUMINANCE4_EXT            LUMINANCE                                      4
  159.     LUMINANCE8_EXT            LUMINANCE                                      8
  160.     LUMINANCE12_EXT            LUMINANCE                                     12
  161.     LUMINANCE16_EXT            LUMINANCE                                     16
  162.         LUMINANCE4_ALPHA4_EXT        LUMINANCE_ALPHA                               4      4
  163.         LUMINANCE6_ALPHA2_EXT        LUMINANCE_ALPHA                               6      2
  164.         LUMINANCE8_ALPHA8_EXT        LUMINANCE_ALPHA                               8      8
  165.         LUMINANCE12_ALPHA4_EXT        LUMINANCE_ALPHA                               4     12
  166.         LUMINANCE12_ALPHA12_EXT        LUMINANCE_ALPHA                              12     12
  167.         LUMINANCE16_ALPHA16_EXT        LUMINANCE_ALPHA                              16     16
  168.     INTENSITY_EXT            INTENSITY                                 ?
  169.     INTENSITY4_EXT            INTENSITY                                 4
  170.     INTENSITY8_EXT            INTENSITY                                 8
  171.     INTENSITY12_EXT            INTENSITY                                12
  172.     INTENSITY16_EXT            INTENSITY                                16
  173.         RGB2_EXT            RGB              2      2      2              
  174.         RGB4_EXT            RGB              4      4      4              
  175.         RGB5_EXT            RGB              5      5      5              
  176.         RGB8_EXT            RGB              8      8      8              
  177.         RGB10_EXT            RGB             10     10     10              
  178.         RGB12_EXT            RGB             12     12     12              
  179.         RGB16_EXT            RGB             16     16     16              
  180.         RGBA2_EXT            RGBA              2      2      2      2       
  181.         RGBA4_EXT            RGBA              4      4      4      4       
  182.         RGB5_A1_EXT            RGBA              5      5      5      1       
  183.         RGBA8_EXT            RGBA              8      8      8      8       
  184.         RGB10_A2_EXT            RGBA             10     10     10      2       
  185.         RGBA12_EXT            RGBA             12     12     12     12       
  186.         RGBA16_EXT            RGBA             16     16     16     16       
  187.  
  188.     All implementations of this extension support the base formats ALPHA,
  189.     LUMINANCE, LUMINANCE_ALPHA, RGB, and RGBA.  All implementations also
  190.     accept all the tokens in the table above, but may not allocate storage
  191.     exactly equal to that indicated in the table.  Instead, storage is
  192.     allocated to best match the resolutions in the table.  The determination
  193.     of best match is left to the implementation.  Storage allocation for the
  194.     base formats (as well as for formats "1", "2", "3", and "4") is an
  195.     implementation dependent compromise of component resolution,
  196.     performance, image size, and memory availability.
  197.     
  198.     It is acceptable for an implementation to vary its allocation of
  199.     internal component resolution based on any TexImage1D or TexImage2D
  200.     parameter, but the allocation must not be a function of any other
  201.     factor, and cannot be changed once it is established.  In particular,
  202.     allocations must be invariant -- the same allocation must be made each
  203.     time a texture image is specified with the same parameter values.
  204.     Provision is made for an application to determine what component
  205.     resolutions are available without having to fully specify the texture
  206.     (see below).
  207.  
  208.     A set of mipmap arrays is incomplete (see the Mipmapping section of the
  209.     GL Specification) if different internal formats are specified for arrays
  210.     in the set, even if the resulting formats of the arrays are identical.
  211.     An implementation can, however, report different component precisions
  212.     for the arrays in the set, even if all were specified with the same
  213.     internal format.  (The set of arrays will be complete in this case.)
  214.  
  215.     The assignments of texture component values from color components
  216.     "extracted" from the incoming image (see the discussion in section 3.8
  217.     of the GL Specification) are defined by this new version of Table 3.6:
  218.  
  219.     Base Internal Format    red    green    blue    alpha    luminance    intensity
  220.     --------------------    ---    -----    ----    -----    ---------    ---------
  221.  
  222.     ALPHA                        A
  223.     LUMINANCE                        R
  224.     LUMINANCE_ALPHA                    A    R
  225.     INTENSITY                                R
  226.     RGB            R    G    B
  227.     RGBA            R    G    B    A
  228.  
  229.     Table 3.6: Correspondence of texture components to extracted
  230.     R, G, B, and A values.
  231.  
  232.     Texture components are assigned to Rt, Gt, Bt, and At.
  233.     Table 3.8 (Texture functions) refers to these components.
  234.     The assignments are defined by the following table:
  235.  
  236.                 Texture Environment
  237.                 -------------------
  238.  
  239.     Base Texture Format    Rt    Gt    Bt    At
  240.     -------------------    --    --    --    --
  241.  
  242.     LUMINANCE        Lt    Lt    Lt    x
  243.  
  244.     ALPHA            x    x    x    At
  245.  
  246.     INTENSITY        It    It    It    It
  247.  
  248.     LUMINANCE_ALPHA        Lt    Lt    Lt    At
  249.  
  250.     RGB            Rt    Gt    Bt    x
  251.  
  252.     RGBA            Rt    Gt    Bt    At
  253.  
  254.     Table ??: Mapping of Texture Components to Rt, Gt, Bt, At.
  255.  
  256.     Where there appears an "x", the assignment is "don't care", since
  257.     that component is not used by the texture environment.
  258.  
  259.     This extension redefines the application of a texture to the color
  260.     components of a fragment.  In particular, a new texture environment, REPLACE,
  261.     and two new texture formats, ALPHA and INTENSITY, are included.
  262.     Table 3.8 (Texture functions) of the GL
  263.     Specification is replaced by the following table:
  264.  
  265.                 Texture Environment
  266.                 -------------------
  267.  
  268.     Base Texture Format    REPLACE        MODULATE    BLEND                DECAL
  269.     -------------------    -------        --------    -----                -----
  270.  
  271.     LUMINANCE        Rv =    Rt    Rv = Rf * Rt    Rv = Rf * (1-Rt) + Rc * Rt    undefined
  272.                 Gv =    Gt    Gv = Gf * Gt    Gv = Gf * (1-Gt) + Gc * Gt
  273.                 Bv =    Bt    Bv = Bf * Bt    Bv = Bf * (1-Bt) + Bc * Bt
  274.                 Av = Af        Av = Af        Av = Af
  275.  
  276.     ALPHA            Rv = Rf        Rv = Rf        Rv = Rf                undefined
  277.                 Gv = Gf        Gv = Gf        Gv = Gf
  278.                 Bv = Bf        Bv = Bf        Bv = Bf
  279.                 Av =    At    Av = Af * At    Av = Af * At
  280.  
  281.     INTENSITY        Rv =    Rt    Rv = Rf * Rt    Rv = Rf * (1-Rt) + Rc * Rt    undefined
  282.                 Gv =    Gt    Gv = Gf * Gt    Gv = Gf * (1-Gt) + Gc * Gt
  283.                 Bv =    Bt    Bv = Bf * Bt    Bv = Bf * (1-Bt) + Bc * Bt
  284.                 Av =    At    Av = Af * At    Av = Af * (1-At) + Ac * At
  285.  
  286.     LUMINANCE_ALPHA        Rv =    Rt    Rv = Rf * Rt    Rv = Rf * (1-Rt) + Rc * Rt    undefined
  287.                 Gv =    Gt    Gv = Gf * Gt    Gv = Gf * (1-Gt) + Gc * Gt
  288.                 Bv =    Bt    Bv = Bf * Bt    Bv = Bf * (1-Bt) + Bc * Bt
  289.                 Av =    At    Av = Af * At    Av = Af * At
  290.  
  291.     RGB            Rv =    Rt    Rv = Rf * Rt    Rv = Rf * (1-Rt) + Rc * Rt    Rv =    Rt
  292.                 Gv =    Gt    Gv = Gf * Gt    Gv = Gf * (1-Gt) + Gc * Gt    Gv =    Gt
  293.                 Bv =    Bt    Bv = Bf * Bt    Bv = Bf * (1-Bt) + Bc * Bt    Bv =    Bt
  294.                 Av = Af        Av = Af        Av = Af                Av = Af
  295.  
  296.     RGBA            Rv =    Rt    Rv = Rf * Rt    Rv = Rf * (1-Rt) + Rc * Rt    Rv = Rf * (1-At) + Rt * At
  297.                 Gv =    Gt    Gv = Gf * Gt    Gv = Gf * (1-Gt) + Gc * Gt    Gv = Gf * (1-At) + Gt * At
  298.                 Bv =    Bt    Bv = Bf * Bt    Bv = Bf * (1-Bt) + Bc * Bt    Bv = Bf * (1-At) + Bt * At
  299.                 Av =    At    Av = Af * At    Av = Af * At            Av = Af
  300.  
  301.     Table 3.8: Texture functions.
  302.  
  303.     Finally, for backward compatibility, the semantics of <components>
  304.     values 1, 2, 3, and 4 are identical to those of LUMINANCE,
  305.     LUMINANCE_ALPHA, RGB, and RGBA respectively.  The one exception is that
  306.     the token values for 1, 2, 3, and 4 are not the same as the token values
  307.     LUMINANCE, LUMINANCE_ALPHA, RGB, and RGBA.
  308.  
  309.     Query support
  310.     -------------
  311.  
  312.     Alternate sets of per-level texture state are defined for the proxy
  313.     textures PROXY_TEXTURE_1D_EXT and PROXY_TEXTURE_2D_EXT.  When TexImage2D
  314.     is called with <target> set to PROXY_TEXTURE_2D_EXT, proxy state values
  315.     TEXTURE_WIDTH, TEXTURE_HEIGHT, TEXTURE_BORDER, TEXTURE_COMPONENTS,
  316.     TEXTURE_RED_SIZE_EXT, TEXTURE_GREEN_SIZE_EXT, TEXTURE_BLUE_SIZE_EXT,
  317.     TEXTURE_ALPHA_SIZE_EXT, TEXTURE_LUMINANCE_SIZE_EXT, and
  318.     TEXTURE_INTENSITY_SIZE_EXT are always recomputed and updated, even if
  319.     the texture is too large to actually be used.  If the texture is too
  320.     large, all of these state variables are set to zero.  If the texture
  321.     could be accommodated by TexImage2D called with <target> TEXTURE_2D,
  322.     these values are set as though TEXTURE_2D were being defined.  All of
  323.     these state value can be queried with GetTexLevelParameteriv or
  324.     GetTexLevelParameterfv with <target> set to PROXY_TEXTURE_2D_EXT.
  325.     Calling TexImage2D with <target> PROXY_TEXTURE_2D_EXT has no effect on
  326.     the actual 2-dimensional texture or its state.
  327.  
  328.     To determine the maximum array size for a mipmap texture, specify and
  329.     query the proxy texture at the highest level that accurately reflects the
  330.     aspect ratio of the desired level zero array.
  331.  
  332.     There is no image associated with PROXY_TEXTURE_2D_EXT.  Therefore
  333.     PROXY_TEXTURE_2D_EXT cannot be used as a texture, and its image must
  334.     never be queried using GetTexImage.  (The error INVALID_ENUM results if
  335.     this is attempted.)  Likewise, there is no nonlevel-related state
  336.     associated with a proxy texture, so calling GetTexParameteriv or
  337.     GetTexParameterfv with <target> PROXY_TEXTURE_2D_EXT results in the
  338.     error INVALID_ENUM.
  339.  
  340.     The proxy 1-dimensional texture behaves identically to the proxy
  341.     2-dimensional texture, except that its state does not include
  342.     TEXTURE_HEIGHT.
  343.  
  344. Additions to Chapter 4 of the GL Specification (Per-Fragment Operations
  345. and the Framebuffer)
  346.  
  347.     None
  348.  
  349. Additions to Chapter 5 of the GL Specification (Special Functions)
  350.  
  351.     None
  352.  
  353. Additions to Chapter 6 of the GL Specification (State and State Requests)
  354.  
  355.     GetTexLevelParameteriv, when called with <pname> TEXTURE_COMPONENTS,
  356.     returns the value of the <components> state variable as specified by the
  357.     application.  This remains true even if the actual internal format
  358.     matches that of another token.
  359.  
  360.     GetTexLevelParameteriv, when called with <pname> TEXTURE_RED_SIZE_EXT,
  361.     TEXTURE_GREEN_SIZE_EXT, TEXTURE_BLUE_SIZE_EXT, TEXTURE_ALPHA_SIZE_EXT,
  362.     TEXTURE_LUMINANCE_SIZE_EXT, or TEXTURE_INTENSITY_SIZE_EXT returns the
  363.     actual number of bits of internal storage for red, green, blue, alpha,
  364.     luminance, or intensity.  This value may not match the value of the
  365.     specified internal format.
  366.  
  367.     GetTexImage continues to operate as though ReadPixels were called with
  368.     the texture image as the framebuffer.  The assignments of texture
  369.     component values to the initial R, G, B, and A values of the read-back
  370.     texel (prior to PixelTransfer and PixelStorage operations) are:
  371.  
  372.     Base Internal Format    R        G    B    A
  373.     --------------------    -        -    -    -
  374.  
  375.     ALPHA            0.0        0.0    0.0    alpha
  376.     LUMINANCE        luminance    0.0    0.0    0.0                        
  377.     LUMINANCE_ALPHA        luminance    0.0    0.0    alpha
  378.     INTENSITY        intensity    0.0    0.0    0.0
  379.     RGB            red        green    blue    0.0
  380.     RGBA            red        green    blue    alpha
  381.  
  382. Additions to the GLX Specification
  383.  
  384.     None
  385.  
  386. GLX Protocol
  387.  
  388.     None
  389.  
  390. Dependencies on EXT_abgr
  391.  
  392.     Token ABGR_EXT cannot be used to specify internal texture image formats.
  393.  
  394. Errors
  395.  
  396.     The GL Specification requires that INVALID_VALUE be generated if any
  397.     texture dimension is specified less than zero, greater than
  398.     MAX_TEXTURE_SIZE, or with a value that cannot be represented as 2**k +
  399.     2*border, for some integer k.  This extension eliminates the requirement
  400.     that all dimensions be specified less than or equal to MAX_TEXTURE_SIZE,
  401.     and replaces it with a new error token and error condition.
  402.     INVALID_VALUE is generated if any texture dimension is specified less
  403.     than zero, or with a value that cannot be represented as 2**k + 2*border.
  404.     TEXTURE_TOO_LARGE_EXT is generated if the texture is too large to be
  405.     accommodated, for whatever reason.  An implementation must specify
  406.     MAX_TEXTURE_SIZE such that TEXTURE_TOO_LARGE_EXT is never generated if
  407.     all the dimensions of the texture are less than or equal to
  408.     MAX_TEXTURE_SIZE.  Also, TEXTURE_TOO_LARGE_EXT is never generated when
  409.     the target is a proxy texture, such as PROXY_TEXTURE_1D_EXT or
  410.     PROXY_TEXTURE_2D_EXT.
  411.  
  412.     This change to the error semantics does not require that the major
  413.     revision level be incremented, because the GL Specification allows for
  414.     changes to error semantics (Section 2.5).
  415.  
  416. New State
  417.  
  418.                                             Initial
  419.     Get Value                Get Command        Type            Value    Attrib
  420.     ---------                -----------        ----            -------    ------
  421.     TEXTURE_RED_SIZE_EXT        GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  422.     TEXTURE_GREEN_SIZE_EXT        GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  423.     TEXTURE_BLUE_SIZE_EXT        GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  424.     TEXTURE_ALPHA_SIZE_EXT        GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  425.     TEXTURE_LUMINANCE_SIZE_EXT        GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  426.     TEXTURE_INTENSITY_SIZE_EXT        GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  427.  
  428.     TEXTURE                GetTexImage        2 x 1 x levels x I    null       -
  429.     TEXTURE_WIDTH            GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  430.     TEXTURE_HEIGHT            GetTexLevelParameteriv    1 x 2 x levels x Z+    0       -
  431.     TEXTURE_BORDER            GetTexLevelParameteriv    2 x 2 x levels x Z+    0       -
  432.     TEXTURE_COMPONENTS            GetTexLevelParameteriv    2 x 2 x levels x Z42    1       -
  433.  
  434. New Implementation Dependent State
  435.  
  436.     None
  437.